mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-02-16 20:15:38 +00:00
Moved the CollectionSystemsManager cleanup from the destructor to a deinit function.
This commit is contained in:
parent
87ace0b8cb
commit
f8e201d347
|
@ -86,36 +86,37 @@ CollectionSystemsManager::CollectionSystemsManager() noexcept
|
|||
mCustomCollectionsBundle = nullptr;
|
||||
}
|
||||
|
||||
CollectionSystemsManager::~CollectionSystemsManager()
|
||||
{
|
||||
// Don't attempt to remove any collections if no systems exist.
|
||||
if (SystemData::sSystemVector.size() > 0)
|
||||
removeCollectionsFromDisplayedSystems();
|
||||
|
||||
// Delete all custom collections.
|
||||
for (std::map<std::string, CollectionSystemData, stringComparator>::const_iterator it =
|
||||
mCustomCollectionSystemsData.cbegin();
|
||||
it != mCustomCollectionSystemsData.cend(); ++it)
|
||||
delete it->second.system;
|
||||
|
||||
// Delete the custom collections bundle.
|
||||
if (mCustomCollectionsBundle)
|
||||
delete mCustomCollectionsBundle;
|
||||
|
||||
// Delete the auto collections systems.
|
||||
for (auto it = mAutoCollectionSystemsData.cbegin(); // Line break.
|
||||
it != mAutoCollectionSystemsData.cend(); ++it)
|
||||
delete (*it).second.system;
|
||||
|
||||
delete mCollectionEnvData;
|
||||
}
|
||||
|
||||
CollectionSystemsManager* CollectionSystemsManager::getInstance()
|
||||
{
|
||||
static CollectionSystemsManager instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
void CollectionSystemsManager::deinit()
|
||||
{
|
||||
// Don't attempt to remove any collections if no systems exist.
|
||||
if (SystemData::sSystemVector.size() > 0) {
|
||||
removeCollectionsFromDisplayedSystems();
|
||||
|
||||
// Delete all custom collections.
|
||||
for (std::map<std::string, CollectionSystemData, stringComparator>::const_iterator it =
|
||||
mCustomCollectionSystemsData.cbegin();
|
||||
it != mCustomCollectionSystemsData.cend(); ++it)
|
||||
delete it->second.system;
|
||||
|
||||
// Delete the custom collections bundle.
|
||||
if (mCustomCollectionsBundle)
|
||||
delete mCustomCollectionsBundle;
|
||||
|
||||
// Delete the auto collections systems.
|
||||
for (auto it = mAutoCollectionSystemsData.cbegin(); // Line break.
|
||||
it != mAutoCollectionSystemsData.cend(); ++it)
|
||||
delete (*it).second.system;
|
||||
}
|
||||
|
||||
delete mCollectionEnvData;
|
||||
}
|
||||
|
||||
void CollectionSystemsManager::saveCustomCollection(SystemData* sys)
|
||||
{
|
||||
const std::string rompath = FileData::getROMDirectory();
|
||||
|
|
|
@ -75,6 +75,9 @@ public:
|
|||
static CollectionSystemsManager* getInstance();
|
||||
void saveCustomCollection(SystemData* sys);
|
||||
|
||||
// Clean up all systems, called during application shutdown.
|
||||
void deinit();
|
||||
|
||||
// Functions to load all collections into memory, and enable the active ones:
|
||||
// Load all collection systems.
|
||||
void loadCollectionSystems();
|
||||
|
@ -133,7 +136,6 @@ public:
|
|||
|
||||
private:
|
||||
CollectionSystemsManager() noexcept;
|
||||
~CollectionSystemsManager();
|
||||
|
||||
SystemEnvironmentData* mCollectionEnvData;
|
||||
std::map<std::string, CollectionSystemDecl, stringComparator> mCollectionSystemDeclsIndex;
|
||||
|
|
|
@ -683,6 +683,7 @@ int main(int argc, char* argv[])
|
|||
delete window->peekGui();
|
||||
window->deinit();
|
||||
|
||||
CollectionSystemsManager::getInstance()->deinit();
|
||||
SystemData::deleteSystems();
|
||||
NavigationSounds::getInstance().deinit();
|
||||
|
||||
|
|
Loading…
Reference in a new issue