mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-05-27 04:11:05 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user