BASE: Fix crash when building with uncached plugins and static detection

This commit is contained in:
Cameron Cawley 2021-02-01 16:51:10 +00:00 committed by Filippos Karapetis
parent c30c22dac8
commit 76ac4414ec
2 changed files with 9 additions and 1 deletions

View file

@ -344,12 +344,14 @@ void PluginManagerUncached::init() {
unloadPluginsExcept(PLUGIN_TYPE_ENGINE, NULL, false); // empty the engine plugins
#ifndef DETECTION_STATIC
Common::String detectPluginName = "detection";
#ifdef PLUGIN_SUFFIX
detectPluginName += PLUGIN_SUFFIX;
#endif
bool foundDetectPlugin = false;
#endif
for (ProviderList::iterator pp = _providers.begin();
pp != _providers.end();
@ -361,6 +363,7 @@ void PluginManagerUncached::init() {
// file plugins. Currently this is the case. If it changes, we
// should find a fast way of detecting whether a plugin is a
// music or an engine plugin.
#ifndef DETECTION_STATIC
if (!foundDetectPlugin && (*pp)->isFilePluginProvider()) {
Common::String pName = (*p)->getFileName();
if (pName.hasSuffix(detectPluginName)) {
@ -370,6 +373,7 @@ void PluginManagerUncached::init() {
continue;
}
}
#endif
if ((*pp)->isFilePluginProvider()) {
_allEnginePlugins.push_back(*p);
@ -443,6 +447,7 @@ void PluginManagerUncached::updateConfigWithFileName(const Common::String &engin
}
}
#ifndef DETECTION_STATIC
void PluginManagerUncached::loadDetectionPlugin() {
bool linkMetaEngines = false;
@ -484,6 +489,7 @@ void PluginManagerUncached::unloadDetectionPlugin() {
debug(9, "Detection plugin is already unloaded.");
}
}
#endif
void PluginManagerUncached::loadFirstPlugin() {
unloadPluginsExcept(PLUGIN_TYPE_ENGINE, NULL, false);