[Scummvm-git-logs] scummvm branch-3-0 -> 64e108821f84a4ea36d68a8c8d39408cb558a70c

dreammaster noreply at scummvm.org
Tue Dec 16 05:51:09 UTC 2025


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://api.github.com/repos/scummvm/scummvm .

Summary:
64e108821f BAGEL: Simplify the quit event handling


Commit: 64e108821f84a4ea36d68a8c8d39408cb558a70c
    https://github.com/scummvm/scummvm/commit/64e108821f84a4ea36d68a8c8d39408cb558a70c
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2025-12-16T16:33:20+11:00

Commit Message:
BAGEL: Simplify the quit event handling

Previously the quit code was mess, with a multi-state quit mode.
This was prone to getting out of sync, resulting in assert
errors, or the game not quitting unless the ScummVM window 'x'
icon was clicked multiple times, or even not at all.

This new simplified version seems to be working okay when quitting
from various windows and dialogs.

Changed paths:
    engines/bagel/mfc/libs/event_loop.cpp


diff --git a/engines/bagel/mfc/libs/event_loop.cpp b/engines/bagel/mfc/libs/event_loop.cpp
index 010e6848ea7..a8965fa6e63 100644
--- a/engines/bagel/mfc/libs/event_loop.cpp
+++ b/engines/bagel/mfc/libs/event_loop.cpp
@@ -169,6 +169,12 @@ void EventLoop::checkMessages() {
 						MAKELPARAM(HTCLIENT, msg.message)
 					);
 			}
+		} else if (msg.message == WM_QUIT) {
+			// Add a window message close message as well
+			MSG cmsg;
+			cmsg.message = WM_CLOSE;
+			cmsg.hwnd = hWnd;
+			_messages.push(cmsg);
 		}
 	}
 
@@ -204,12 +210,14 @@ bool EventLoop::GetMessage(MSG &msg) {
 			}
 		} else if (msg.message != WM_QUIT) {
 			msg.message = WM_NULL;
+		} else {
+			debug(1, "Got WM_QUIT message..");
 		}
 	} else {
 		msg.message = WM_NULL;
 	}
 
-	return _quitFlag != QUIT_QUIT;
+	return !((msg.message == WM_QUIT) || (shouldQuit() && _messages.empty()));
 }
 
 void EventLoop::setMessageWnd(Common::Event &ev, HWND &hWnd) {
@@ -356,7 +364,7 @@ bool EventLoop::PostMessage(HWND hWnd, unsigned int Msg,
 		// so we can ignore the WM_PARENTNOTIFY on closure
 		return false;
 
-	assert((hWnd || Msg == WM_QUIT) && hWnd != (HWND)0xdddddddd);
+	assert(hWnd);
 	_messages.push(MSG(hWnd, Msg, wParam, lParam));
 	return true;
 }




More information about the Scummvm-git-logs mailing list