Workaround for bug in glfw causing crash when hotplugging monitors

Fixes #812
This commit is contained in:
Kovid Goyal 2018-08-21 12:52:16 +05:30
parent ec1c72e9a3
commit 96c444d041
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

22
glfw/x11_monitor.c vendored
View File

@ -326,13 +326,15 @@ void _glfwPlatformGetMonitorPos(_GLFWmonitor* monitor, int* xpos, int* ypos)
sr = XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root);
ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc);
if (ci)
{
if (xpos)
*xpos = ci->x;
if (ypos)
*ypos = ci->y;
if (xpos)
*xpos = ci->x;
if (ypos)
*ypos = ci->y;
XRRFreeCrtcInfo(ci);
XRRFreeCrtcInfo(ci);
}
XRRFreeScreenResources(sr);
}
}
@ -411,9 +413,13 @@ void _glfwPlatformGetVideoMode(_GLFWmonitor* monitor, GLFWvidmode* mode)
sr = XRRGetScreenResourcesCurrent(_glfw.x11.display, _glfw.x11.root);
ci = XRRGetCrtcInfo(_glfw.x11.display, sr, monitor->x11.crtc);
*mode = vidmodeFromModeInfo(getModeInfo(sr, ci->mode), ci);
if (ci) {
const XRRModeInfo* mi = getModeInfo(sr, ci->mode);
if (mi) // mi can be NULL if the monitor has been disconnected
*mode = vidmodeFromModeInfo(mi, ci);
XRRFreeCrtcInfo(ci);
XRRFreeCrtcInfo(ci);
}
XRRFreeScreenResources(sr);
}
else