Fix assert when exiting game in scenario editor

The object selection window loads objects when it is closed which is triggered from window_close_all. We need to unload all the objects after this step on shutdown.
This commit is contained in:
Ted John 2019-08-21 21:32:34 +01:00
parent 6d80e65783
commit adb5c3aa7f
1 changed files with 7 additions and 4 deletions

View File

@ -149,14 +149,17 @@ namespace OpenRCT2
// NOTE: We must shutdown all systems here before Instance is set back to null. // NOTE: We must shutdown all systems here before Instance is set back to null.
// If objects use GetContext() in their destructor things won't go well. // If objects use GetContext() in their destructor things won't go well.
if (_objectManager) GameActions::ClearQueue();
network_close();
window_close_all();
// Unload objects after closing all windows, this is to overcome windows like
// the object selection window which loads objects when closed.
if (_objectManager != nullptr)
{ {
_objectManager->UnloadAll(); _objectManager->UnloadAll();
} }
GameActions::ClearQueue();
network_close();
window_close_all();
gfx_object_check_all_images_freed(); gfx_object_check_all_images_freed();
gfx_unload_g2(); gfx_unload_g2();
gfx_unload_g1(); gfx_unload_g1();