Do not store pointer before potentialy freeing it
Store data to windows->driverdata after call to SetProp() in case it fails.
This commit is contained in:
committed by
Sam Lantinga
parent
36dec0bf4e
commit
4d00706f57
@@ -388,8 +388,6 @@ static int SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, HWND hwnd
|
|||||||
|
|
||||||
SDL_AddHintCallback(SDL_HINT_MOUSE_RELATIVE_MODE_CENTER, WIN_MouseRelativeModeCenterChanged, data);
|
SDL_AddHintCallback(SDL_HINT_MOUSE_RELATIVE_MODE_CENTER, WIN_MouseRelativeModeCenterChanged, data);
|
||||||
|
|
||||||
window->driverdata = data;
|
|
||||||
|
|
||||||
#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
|
#if !defined(SDL_PLATFORM_XBOXONE) && !defined(SDL_PLATFORM_XBOXSERIES)
|
||||||
/* Associate the data with the window */
|
/* Associate the data with the window */
|
||||||
if (!SetProp(hwnd, TEXT("SDL_WindowData"), data)) {
|
if (!SetProp(hwnd, TEXT("SDL_WindowData"), data)) {
|
||||||
@@ -399,6 +397,8 @@ static int SetupWindowData(SDL_VideoDevice *_this, SDL_Window *window, HWND hwnd
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
window->driverdata = data;
|
||||||
|
|
||||||
/* Set up the window proc function */
|
/* Set up the window proc function */
|
||||||
#ifdef GWLP_WNDPROC
|
#ifdef GWLP_WNDPROC
|
||||||
data->wndproc = (WNDPROC)GetWindowLongPtr(hwnd, GWLP_WNDPROC);
|
data->wndproc = (WNDPROC)GetWindowLongPtr(hwnd, GWLP_WNDPROC);
|
||||||
|
|||||||
Reference in New Issue
Block a user