From df10bf5ae08f36244180064e334161ce53b54c7b Mon Sep 17 00:00:00 2001 From: Vincent Wei Date: Sun, 16 Feb 2020 18:44:08 +0800 Subject: [PATCH] call mg_GetMsgQueueForThisThread and mg_FreeMsgQueueForThisThread only for _MGHAVE_VIRTUAL_WINDOW --- src/gui/window.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/gui/window.c b/src/gui/window.c index 10484de6..227381ba 100644 --- a/src/gui/window.c +++ b/src/gui/window.c @@ -3770,10 +3770,12 @@ BOOL GUIAPI MainWindowCleanup (HWND hMainWnd) MG_CHECK_RET (MG_IS_MAIN_WINDOW (hMainWnd), FALSE); pMainWin = MG_GET_MAIN_WINDOW_PTR (hMainWnd); +#ifdef _MGHAVE_VIRTUAL_WINDOW if (!(pMsgQueue = mg_GetMsgQueueForThisThread (FALSE)) || pMainWin->pMsgQueue != pMsgQueue) { return FALSE; } +#endif _DBG_PRINTF ("window(%p), caption(%s)\n", pMainWin, pMainWin->spCaption); @@ -3789,9 +3791,11 @@ BOOL GUIAPI MainWindowCleanup (HWND hMainWnd) #endif pMsgQueue->nrWindows--; +#ifdef _MGHAVE_VIRTUAL_WINDOW if (pMsgQueue->nrWindows == 0) { mg_FreeMsgQueueForThisThread (); } +#endif free (pMainWin); return TRUE; @@ -3870,7 +3874,8 @@ HWND GUIAPI CreateMainWindowEx2 (PMAINWINCREATE pCreateInfo, if (pWin->pMsgQueue->pRootMainWin == NULL) { pWin->pMsgQueue->pRootMainWin = pWin; } - else if (hHosting == HWND_DESKTOP || hHosting == HWND_NULL) { + else if (pCreateInfo->hHosting == HWND_DESKTOP || + pCreateInfo->hHosting == HWND_NULL) { pWin->pHosting = pWin->pMsgQueue->pRootMainWin; } else {