From f17a7a96da9f51c5c4735ff34f985516157fcbef Mon Sep 17 00:00:00 2001 From: Bastien Bouclet Date: Sat, 4 Jan 2020 17:21:53 +0100 Subject: BASE: Fix being unable to run games when using dynamic plugins When the plugin-engine mapping is not cached in the configuration file, we were not scanning all the plugins to establish the mapping. This is a regression from commit: e2d91258b7bfb989dc099f516bb31ceb44554529 This commit reverts the offending commit and implements a proper fix for the case where there are no dynamic plugins. Fixes #11300. --- backends/plugins/elf/elf-provider.cpp | 16 ++++++++-------- backends/plugins/elf/memory-manager.cpp | 6 +++++- 2 files changed, 13 insertions(+), 9 deletions(-) (limited to 'backends') diff --git a/backends/plugins/elf/elf-provider.cpp b/backends/plugins/elf/elf-provider.cpp index 6d461c79df..d06c4c1ca1 100644 --- a/backends/plugins/elf/elf-provider.cpp +++ b/backends/plugins/elf/elf-provider.cpp @@ -181,15 +181,15 @@ PluginList ELFPluginProvider::getPlugins() { PluginList pl = FilePluginProvider::getPlugins(); #if defined(UNCACHED_PLUGINS) && !defined(ELF_NO_MEM_MANAGER) - if (!pl.empty()) { - // This static downcast is safe because all of the plugins must - // be ELF plugins - for (PluginList::iterator p = pl.begin(); p != pl.end(); ++p) { - (static_cast(*p))->trackSize(); - } + // This static downcast is safe because all of the plugins must + // be ELF plugins + for (PluginList::iterator p = pl.begin(); p != pl.end(); ++p) { + (static_cast(*p))->trackSize(); + } - // The Memory Manager should now allocate space based on the information - // it collected + // The Memory Manager should now allocate space based on the information + // it collected + if (!pl.empty()) { ELFMemMan.allocateHeap(); } #endif diff --git a/backends/plugins/elf/memory-manager.cpp b/backends/plugins/elf/memory-manager.cpp index 5014718ae8..6e54cb8e29 100644 --- a/backends/plugins/elf/memory-manager.cpp +++ b/backends/plugins/elf/memory-manager.cpp @@ -78,9 +78,13 @@ void ELFMemoryManager::trackAlloc(uint32 align, uint32 size) { } void ELFMemoryManager::allocateHeap() { + if (!_heapSize) { + warning("ELFMemoryManager: Unable to allocate the heap as its size could not be determined."); + return; + } + // The memory manager should only allocate once assert (!_heap); - assert (_heapSize); // clear the list _allocList.clear(); -- cgit v1.2.3