Clear console pointers earlier

It doesn't make a lot of sense to keep console pointers around while the
objects and scripts have already been deleted. Clear them earlier so we
don't have any dangling pointers.
directional-lights
Nicolas Hake 2016-10-11 19:32:10 +02:00
parent 170a793a44
commit 14bfd7ea59
1 changed files with 7 additions and 6 deletions

View File

@ -578,6 +578,13 @@ void C4Game::Clear()
StartupScenarioParameters.Clear();
Weather.Clear();
GraphicsSystem.Clear();
#ifdef WITH_QT_EDITOR
// clear console pointers held into script engine
::Console.EditCursor.Clear();
::Console.ClearGamePointers();
#endif
// Clear the particles before cleaning up the objects.
Particles.Clear();
DeleteObjects(true);
@ -607,12 +614,6 @@ void C4Game::Clear()
::FontLoader.Clear();
#endif
#ifdef WITH_QT_EDITOR
// clear console pointers held into script engine
::Console.EditCursor.Clear();
::Console.ClearGamePointers();
#endif
C4PropListNumbered::ClearShelve(); // may be nonempty if there was a fatal error during section load
ScriptEngine.Clear();
// delete any remaining prop lists from circular chains