[Scummvm-git-logs] scummvm master -> 27ee3640af0d653dd7d6280a54766e9acf9ad524

dreammaster noreply at scummvm.org
Sat May 4 22:58:27 UTC 2024


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

Summary:
895c665654 ENGINES: Re-apply Allow shouldQuit to return true immediately
27ee3640af ENGINES: Purge any remaining events when quitting an engine


Commit: 895c665654660584c652623eafea60bdee9fc1ca
    https://github.com/scummvm/scummvm/commit/895c665654660584c652623eafea60bdee9fc1ca
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2024-05-04T15:53:39-07:00

Commit Message:
ENGINES: Re-apply Allow shouldQuit to return true immediately

This reverts the revert commit 09de1bbca8f83fb8f154ea9cb9070af48fa2112d.

Changed paths:
    engines/engine.cpp
    engines/engine.h


diff --git a/engines/engine.cpp b/engines/engine.cpp
index cc2a6d61290..91b84314899 100644
--- a/engines/engine.cpp
+++ b/engines/engine.cpp
@@ -64,6 +64,7 @@
 
 // FIXME: HACK for error()
 Engine *g_engine = 0;
+bool Engine::_quitRequested;
 
 // Output formatter for debug() and error() which invokes
 // the errorString method of the active engine, if any.
@@ -153,6 +154,7 @@ Engine::Engine(OSystem *syst)
 		_lastAutosaveTime(_system->getMillis()) {
 
 	g_engine = this;
+	_quitRequested = false;
 	Common::setErrorOutputFormatter(defaultOutputFormatter);
 	Common::setErrorHandler(defaultErrorHandler);
 
@@ -983,11 +985,13 @@ void Engine::quitGame() {
 
 	event.type = Common::EVENT_QUIT;
 	g_system->getEventManager()->pushEvent(event);
+	_quitRequested = true;
 }
 
 bool Engine::shouldQuit() {
 	Common::EventManager *eventMan = g_system->getEventManager();
-	return (eventMan->shouldQuit() || eventMan->shouldReturnToLauncher());
+	return eventMan->shouldQuit() || eventMan->shouldReturnToLauncher()
+		|| _quitRequested;
 }
 
 GUI::Debugger *Engine::getOrCreateDebugger() {
diff --git a/engines/engine.h b/engines/engine.h
index ade46d5fd9b..0b176bee852 100644
--- a/engines/engine.h
+++ b/engines/engine.h
@@ -233,9 +233,13 @@ private:
 	 * Optional debugger for the engine.
 	 */
 	GUI::Debugger *_debugger;
-public:
 
+	/**
+	 * Flag for whether the quitGame method has been called
+	 */
+	static bool _quitRequested;
 
+public:
 	/**
 	 * Engine features.
 	 *


Commit: 27ee3640af0d653dd7d6280a54766e9acf9ad524
    https://github.com/scummvm/scummvm/commit/27ee3640af0d653dd7d6280a54766e9acf9ad524
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2024-05-04T15:54:23-07:00

Commit Message:
ENGINES: Purge any remaining events when quitting an engine

Changed paths:
    engines/engine.cpp


diff --git a/engines/engine.cpp b/engines/engine.cpp
index 91b84314899..a29c632922c 100644
--- a/engines/engine.cpp
+++ b/engines/engine.cpp
@@ -198,6 +198,10 @@ Engine::Engine(OSystem *syst)
 Engine::~Engine() {
 	_mixer->stopAll();
 
+	// Flush any pending remaining events
+	Common::Event evt;
+	while (g_system->getEventManager()->pollEvent(evt)) {}
+
 	delete _debugger;
 	delete _mainMenuDialog;
 	g_engine = NULL;




More information about the Scummvm-git-logs mailing list