[win] Avoid double destroy of window

I suspect it's from the recent event rework, but DestroyWindow seems to
be getting called twice, despite the null protection. Not good.
This commit is contained in:
Bill Currie 2023-11-25 10:51:50 +09:00
parent 43ce0eb3ec
commit 78113919ea
2 changed files with 4 additions and 7 deletions

View file

@ -522,10 +522,6 @@ Win_CloseDisplay (void)
PostMessage (HWND_BROADCAST, WM_SYSCOLORCHANGE, (WPARAM) 0, (LPARAM) 0); PostMessage (HWND_BROADCAST, WM_SYSCOLORCHANGE, (WPARAM) 0, (LPARAM) 0);
Win_Activate (false, false); Win_Activate (false, false);
//FIXME? if (hwnd_dialog) DestroyWindow (hwnd_dialog);
if (win_mainwindow)
DestroyWindow (win_mainwindow);
vid_testingmode = 0; vid_testingmode = 0;
viddef.initialized = false; viddef.initialized = false;
} }
@ -871,6 +867,7 @@ notify_destroy (HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{ {
if (win_mainwindow) { if (win_mainwindow) {
DestroyWindow (win_mainwindow); DestroyWindow (win_mainwindow);
win_mainwindow = 0;
} }
PostQuitMessage (0); PostQuitMessage (0);
return 1; return 1;

View file

@ -40,9 +40,9 @@
static vid_internal_t vid_internal; static vid_internal_t vid_internal;
static void static void
VID_shutdown (void *data) Win_VID_shutdown (void *data)
{ {
Sys_MaskPrintf (SYS_vid, "VID_shutdown\n"); Sys_MaskPrintf (SYS_vid, "Win_VID_shutdown\n");
Win_CloseDisplay (); Win_CloseDisplay ();
} }
@ -62,7 +62,7 @@ Win_VID_SetPalette (byte *palette, byte *colormap)
static void static void
Win_VID_Init (byte *palette, byte *colormap) Win_VID_Init (byte *palette, byte *colormap)
{ {
Sys_RegisterShutdown (VID_shutdown, 0); Sys_RegisterShutdown (Win_VID_shutdown, 0);
vid_internal.gl_context = Win_GL_Context; vid_internal.gl_context = Win_GL_Context;
vid_internal.sw_context = Win_SW_Context; vid_internal.sw_context = Win_SW_Context;