mirror of
https://github.com/glfw/glfw.git
synced 2024-11-11 13:03:52 +00:00
Win32: Check for monitor object creation failure
This commit is contained in:
parent
5fe4dfb511
commit
b215a989f5
@ -94,6 +94,7 @@ void _glfwPollMonitorsWin32(void)
|
|||||||
_GLFWmonitor** disconnected = NULL;
|
_GLFWmonitor** disconnected = NULL;
|
||||||
DWORD adapterIndex, displayIndex;
|
DWORD adapterIndex, displayIndex;
|
||||||
DISPLAY_DEVICEW adapter, display;
|
DISPLAY_DEVICEW adapter, display;
|
||||||
|
_GLFWmonitor* monitor;
|
||||||
|
|
||||||
disconnectedCount = _glfw.monitorCount;
|
disconnectedCount = _glfw.monitorCount;
|
||||||
if (disconnectedCount)
|
if (disconnectedCount)
|
||||||
@ -145,8 +146,14 @@ void _glfwPollMonitorsWin32(void)
|
|||||||
if (i < disconnectedCount)
|
if (i < disconnectedCount)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
_glfwInputMonitor(createMonitor(&adapter, &display),
|
monitor = createMonitor(&adapter, &display);
|
||||||
GLFW_CONNECTED, type);
|
if (!monitor)
|
||||||
|
{
|
||||||
|
free(disconnected);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_glfwInputMonitor(monitor, GLFW_CONNECTED, type);
|
||||||
|
|
||||||
type = _GLFW_INSERT_LAST;
|
type = _GLFW_INSERT_LAST;
|
||||||
}
|
}
|
||||||
@ -169,8 +176,14 @@ void _glfwPollMonitorsWin32(void)
|
|||||||
if (i < disconnectedCount)
|
if (i < disconnectedCount)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
_glfwInputMonitor(createMonitor(&adapter, NULL),
|
monitor = createMonitor(&adapter, NULL);
|
||||||
GLFW_CONNECTED, type);
|
if (!monitor)
|
||||||
|
{
|
||||||
|
free(disconnected);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
_glfwInputMonitor(monitor, GLFW_CONNECTED, type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user