mirror of
https://github.com/gwm17/glfw.git
synced 2024-11-23 02:38:52 -05:00
Added clearing of callbacks on terminate.
This commit is contained in:
parent
a6a5fa937c
commit
63a191eb8d
|
@ -150,6 +150,8 @@ GLFWAPI void glfwTerminate(void)
|
|||
if (!_glfwInitialized)
|
||||
return;
|
||||
|
||||
memset(&_glfw.callbacks, 0, sizeof(_glfw.callbacks));
|
||||
|
||||
// Close all remaining windows
|
||||
while (_glfw.windowListHead)
|
||||
glfwDestroyWindow((GLFWwindow*) _glfw.windowListHead);
|
||||
|
|
|
@ -304,7 +304,10 @@ struct _GLFWlibrary
|
|||
|
||||
_GLFWmonitor** monitors;
|
||||
int monitorCount;
|
||||
GLFWmonitorfun monitorCallback;
|
||||
|
||||
struct {
|
||||
GLFWmonitorfun monitor;
|
||||
} callbacks;
|
||||
|
||||
// This is defined in the window API's platform.h
|
||||
_GLFW_PLATFORM_LIBRARY_WINDOW_STATE;
|
||||
|
|
|
@ -141,8 +141,8 @@ void _glfwInputMonitorChange(void)
|
|||
window->monitor = NULL;
|
||||
}
|
||||
|
||||
if (_glfw.monitorCallback)
|
||||
_glfw.monitorCallback((GLFWmonitor*) monitors[i], GLFW_DISCONNECTED);
|
||||
if (_glfw.callbacks.monitor)
|
||||
_glfw.callbacks.monitor((GLFWmonitor*) monitors[i], GLFW_DISCONNECTED);
|
||||
}
|
||||
|
||||
// Find and report newly connected monitors (not in the old list)
|
||||
|
@ -163,8 +163,8 @@ void _glfwInputMonitorChange(void)
|
|||
if (j < monitorCount)
|
||||
continue;
|
||||
|
||||
if (_glfw.monitorCallback)
|
||||
_glfw.monitorCallback((GLFWmonitor*) _glfw.monitors[i], GLFW_CONNECTED);
|
||||
if (_glfw.callbacks.monitor)
|
||||
_glfw.callbacks.monitor((GLFWmonitor*) _glfw.monitors[i], GLFW_CONNECTED);
|
||||
}
|
||||
|
||||
_glfwDestroyMonitors(monitors, monitorCount);
|
||||
|
@ -326,7 +326,7 @@ GLFWAPI const char* glfwGetMonitorName(GLFWmonitor* handle)
|
|||
GLFWAPI GLFWmonitorfun glfwSetMonitorCallback(GLFWmonitorfun cbfun)
|
||||
{
|
||||
_GLFW_REQUIRE_INIT_OR_RETURN(NULL);
|
||||
_GLFW_SWAP_POINTERS(_glfw.monitorCallback, cbfun);
|
||||
_GLFW_SWAP_POINTERS(_glfw.callbacks.monitor, cbfun);
|
||||
return cbfun;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user