From dfc7e95fcd45acf344e9f06166dcae0bf2a6fef2 Mon Sep 17 00:00:00 2001 From: Vincent Wei Date: Wed, 21 Sep 2022 10:40:22 +0800 Subject: [PATCH] fix the bug reported in Issue #89 --- src/kernel/desktop.c | 2 ++ src/kernel/message.c | 16 +++++----------- 2 files changed, 7 insertions(+), 11 deletions(-) diff --git a/src/kernel/desktop.c b/src/kernel/desktop.c index 01d6d36a..a2b04c98 100644 --- a/src/kernel/desktop.c +++ b/src/kernel/desktop.c @@ -4507,7 +4507,9 @@ int __mg_join_all_message_threads (void) list_for_each (l, &msg_queue_list) { MSGQUEUE *msg_queue = (MSGQUEUE*)l; +#ifndef NDEBUG dump_message_queue (msg_queue, __func__); +#endif pthread_cancel (msg_queue->th); } diff --git a/src/kernel/message.c b/src/kernel/message.c index dd2135e9..1a8a963a 100644 --- a/src/kernel/message.c +++ b/src/kernel/message.c @@ -823,8 +823,9 @@ checkagain: goto got_ret; } } - else + else { pMsgQueue->dwState &= ~QS_POSTMSG; + } } /* @@ -1410,6 +1411,9 @@ LRESULT GUIAPI DispatchMessage (PMSG pMsg) to the controls of the main window will be thrown away as well. */ int __mg_throw_away_messages (PMSGQUEUE pMsgQueue, HWND hWnd) { + /* For a main window, we use pMainWin to check whether we + should throw away a message for controls of the main window. + Note that checkAndGetMainWindowIfControl returns NULL for non control. */ PMAINWIN pMainWin = (PMAINWIN)hWnd; PMSG pMsg; PQMSG pQMsg; @@ -1421,16 +1425,6 @@ int __mg_throw_away_messages (PMSGQUEUE pMsgQueue, HWND hWnd) LOCK_MSGQ (pMsgQueue); - /* for virtual window and main window, use pMainWin to check whether we - should throw away a message for controls of a main window. - checkAndGetMainWindowIfControl returns NULL for non control. */ - if (pMainWin != HWND_NULL && pMainWin != HWND_INVALID && - (pMainWin->WinType == TYPE_MAINWIN || - pMainWin->WinType == TYPE_VIRTWIN)) - pMainWin = (PMAINWIN)hWnd; - else - pMainWin = NULL; - if (pMsgQueue->pFirstNotifyMsg) { PQMSG pPrev = NULL, pNext; pQMsg = pMsgQueue->pFirstNotifyMsg;