BASE: Unload plugins when exiting after processing arguments

When not displaying the GUI, plugins are not unloaded.
This can cause problems on AmigaOS where plugins must be unloaded before
exiting. Else, some plugins with global destructors cause crashes being
destroyed too late.
This commit is contained in:
Le Philousophe 2021-05-14 23:25:04 +02:00
parent 0b5f5a2962
commit 610fdfade8

View file

@ -457,6 +457,11 @@ extern "C" int scummvm_main(int argc, const char * const argv[]) {
if (Base::processSettings(command, settings, res)) {
if (res.getCode() != Common::kNoError)
warning("%s", res.getDesc().c_str());
PluginManager::instance().unloadDetectionPlugin();
PluginManager::instance().unloadAllPlugins();
PluginManager::destroy();
return res.getCode();
}