From 457127d2a6aba99a33b3d1212f1406a8c40dc29e Mon Sep 17 00:00:00 2001 From: Yotam Barnoy Date: Mon, 15 Nov 2010 13:36:34 +0000 Subject: 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 --- base/main.cpp | 10 +++++----- 1 file 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. -- cgit v1.2.3