aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYotam Barnoy2010-11-15 13:36:34 +0000
committerYotam Barnoy2010-11-15 13:36:34 +0000
commit457127d2a6aba99a33b3d1212f1406a8c40dc29e (patch)
tree0beddd8beddfc9fc81db80c4647c4c36fe5a7249
parent8664535029e2806676dd5f1db975a5dbb0ac86c5 (diff)
downloadscummvm-rg350-457127d2a6aba99a33b3d1212f1406a8c40dc29e.tar.gz
scummvm-rg350-457127d2a6aba99a33b3d1212f1406a8c40dc29e.tar.bz2
scummvm-rg350-457127d2a6aba99a33b3d1212f1406a8c40dc29e.zip
PLUGINS: moved plugin-at-a-time unload to be after deleting the engine.
Calling the Engine's destructor after unloading the plugin caused crashes. svn-id: r54242
-rw-r--r--base/main.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/base/main.cpp b/base/main.cpp
index 3e4af53065..900d73a28d 100644
--- a/base/main.cpp
+++ b/base/main.cpp
@@ -215,11 +215,6 @@ static Common::Error runGame(const EnginePlugin *plugin, OSystem &system, const
// Run the engine
Common::Error result = engine->run();
-#if defined(ONE_PLUGIN_AT_A_TIME) && defined(DYNAMIC_MODULES)
- // do our best to prevent fragmentation by unloading as soon as we can
- PluginManager::instance().unloadPluginsExcept(PLUGIN_TYPE_ENGINE, NULL, false);
-#endif
-
// Inform backend that the engine finished
system.engineDone();
@@ -410,6 +405,11 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
// Try to run the game
Common::Error result = runGame(plugin, system, specialDebug);
+ #if defined(ONE_PLUGIN_AT_A_TIME) && defined(DYNAMIC_MODULES)
+ // do our best to prevent fragmentation by unloading as soon as we can
+ PluginManager::instance().unloadPluginsExcept(PLUGIN_TYPE_ENGINE, NULL, false);
+ #endif
+
// Did an error occur ?
if (result != Common::kNoError) {
// Shows an informative error dialog if starting the selected game failed.