From 04ea2112bd21d71fe0b026540ac4977022416c94 Mon Sep 17 00:00:00 2001 From: Camilla Berglund Date: Fri, 23 May 2014 13:24:36 +0200 Subject: [PATCH] Fixed possible use of invalid HWND. --- src/win32_window.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/win32_window.c b/src/win32_window.c index 52423fe0..e6a6e13d 100644 --- a/src/win32_window.c +++ b/src/win32_window.c @@ -930,24 +930,24 @@ static int createWindow(_GLFWwindow* window, free(wideTitle); - if (_glfw_ChangeWindowMessageFilterEx) - { - _glfw_ChangeWindowMessageFilterEx(window->win32.handle, - WM_DROPFILES, MSGFLT_ALLOW, NULL); - _glfw_ChangeWindowMessageFilterEx(window->win32.handle, - WM_COPYDATA, MSGFLT_ALLOW, NULL); - _glfw_ChangeWindowMessageFilterEx(window->win32.handle, - WM_COPYGLOBALDATA, MSGFLT_ALLOW, NULL); - } - - DragAcceptFiles(window->win32.handle, TRUE); - if (!window->win32.handle) { _glfwInputError(GLFW_PLATFORM_ERROR, "Win32: Failed to create window"); return GL_FALSE; } + if (_glfw_ChangeWindowMessageFilterEx) + { + _glfw_ChangeWindowMessageFilterEx(window->win32.handle, + WM_DROPFILES, MSGFLT_ALLOW, NULL); + _glfw_ChangeWindowMessageFilterEx(window->win32.handle, + WM_COPYDATA, MSGFLT_ALLOW, NULL); + _glfw_ChangeWindowMessageFilterEx(window->win32.handle, + WM_COPYGLOBALDATA, MSGFLT_ALLOW, NULL); + } + + DragAcceptFiles(window->win32.handle, TRUE); + if (!_glfwCreateContext(window, ctxconfig, fbconfig)) return GL_FALSE;