mirror of
https://github.com/glfw/glfw.git
synced 2026-01-11 15:23:17 +01:00
Fix missing checks for platform mismatch
The native access functions for monitor objects did not check whether the correct platform was initialized and would return invalid handles if it was not.
This commit is contained in:
@@ -622,6 +622,13 @@ GLFWAPI CGDirectDisplayID glfwGetCocoaMonitor(GLFWmonitor* handle)
|
||||
{
|
||||
_GLFWmonitor* monitor = (_GLFWmonitor*) handle;
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(kCGNullDirectDisplay);
|
||||
|
||||
if (_glfw.platform.platformID != GLFW_PLATFORM_COCOA)
|
||||
{
|
||||
_glfwInputError(GLFW_PLATFORM_UNAVAILABLE, "Cocoa: Platform not initialized");
|
||||
return kCGNullDirectDisplay;
|
||||
}
|
||||
|
||||
return monitor->ns.displayID;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user