mirror of
https://github.com/RetroDECK/ES-DE.git
synced 2025-02-16 12:05:38 +00:00
Fixed an issue where the application shutdown was not always clean
This commit is contained in:
parent
54cf23b2d7
commit
fed4dda4ac
|
@ -873,6 +873,7 @@ int main(int argc, char* argv[])
|
|||
delete window->peekGui();
|
||||
window->deinit();
|
||||
|
||||
TextureResource::setExit();
|
||||
CollectionSystemsManager::getInstance()->deinit(true);
|
||||
SystemData::deleteSystems();
|
||||
NavigationSounds::getInstance().deinit();
|
||||
|
|
|
@ -177,7 +177,7 @@ void TextureLoader::threadProc()
|
|||
}
|
||||
}
|
||||
// Queue has been released here but we might have a texture to process.
|
||||
while (textureData) {
|
||||
while (!mExit && textureData) {
|
||||
textureData->load();
|
||||
|
||||
// See if there is another item in the queue.
|
||||
|
|
|
@ -29,6 +29,7 @@ public:
|
|||
void load(std::shared_ptr<TextureData> textureData);
|
||||
void remove(std::shared_ptr<TextureData> textureData);
|
||||
|
||||
void setExit() { mExit = true; }
|
||||
size_t getQueueSize();
|
||||
|
||||
private:
|
||||
|
@ -83,6 +84,12 @@ public:
|
|||
size_t getQueueSize();
|
||||
// Load a texture, freeing resources as necessary to make space.
|
||||
void load(std::shared_ptr<TextureData> tex, bool block = false);
|
||||
// Make sure that threadProc() does not continue to run during application shutdown.
|
||||
void setExit()
|
||||
{
|
||||
if (mLoader)
|
||||
mLoader->setExit();
|
||||
}
|
||||
|
||||
private:
|
||||
std::list<std::shared_ptr<TextureData>> mTextures;
|
||||
|
|
|
@ -80,6 +80,8 @@ public:
|
|||
// Returns the number of bytes that would be used if all textures were in memory.
|
||||
static size_t getTotalTextureSize();
|
||||
|
||||
static void setExit() { sTextureDataManager.setExit(); }
|
||||
|
||||
protected:
|
||||
TextureResource(const std::string& path,
|
||||
float tileWidth,
|
||||
|
|
Loading…
Reference in a new issue