Fix crash with eglGetDisplay(EGL_DEFAULT_DISPLAY) on linux

* We'll try to get a default display when xlib is available, otherwise there's
  nothing we can do and keyboard input will not be available.
This commit is contained in:
baldurk
2020-03-30 13:07:15 +01:00
parent 81c46c9b1e
commit 3bdccf37e6
2 changed files with 14 additions and 1 deletions
+11 -1
View File
@@ -162,7 +162,17 @@ HOOK_EXPORT EGLDisplay EGLAPIENTRY eglGetDisplay_renderdoc_hooked(EGLNativeDispl
EnsureRealLibraryLoaded();
#if ENABLED(RDOC_LINUX)
Keyboard::UseUnknownDisplay((void *)display);
// display can be EGL_DEFAULT_DISPLAY which is NULL, and unfortunately we don't have anything then
if(display)
Keyboard::UseUnknownDisplay((void *)display);
// if xlib is compiled we can try to get the default display (which is what this will do)
#if ENABLED(RDOC_XLIB)
else
Keyboard::UseUnknownDisplay(XOpenDisplay(NULL));
#endif
#endif
return EGL.GetDisplay(display);
@@ -509,6 +509,9 @@ bool GetWaylandKeyState(int key)
WindowingSystem UseUnknownDisplay(void *disp)
{
if(disp == NULL)
return WindowingSystem::Unknown;
// could be wayland or xlib, try to detect.
// both Display* and wl_display* are valid pointers, so dereference and read the first pointer
// sized bytes