summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-06-24 22:05:15 +0200
committerGitHub <noreply@github.com>2020-06-24 22:05:15 +0200
commit7dac5bd2b01e02ecbc76565e765c8196707cbd6d (patch)
tree582a9b82f47a0c67ab943af049e00e680d695962
parent850134aff920200abffc505a0a830accca820eca (diff)
parent6480efba45ae467e38955012d67857a4a81b752b (diff)
Merge pull request #39798 from akien-mga/main-keep-messagequeue-to-deinit-scene
Main::cleanup: Move MessageQueue deletion further down where it's safer
-rw-r--r--main/main.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/main/main.cpp b/main/main.cpp
index 747b12677d..91ff222f57 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -2321,8 +2321,8 @@ void Main::cleanup() {
ResourceLoader::remove_custom_loaders();
ResourceSaver::remove_custom_savers();
+ // Flush before uninitializing the scene, but delete the MessageQueue as late as possible.
message_queue->flush();
- memdelete(message_queue);
OS::get_singleton()->delete_main_loop();
@@ -2408,6 +2408,10 @@ void Main::cleanup() {
OS::get_singleton()->set_restart_on_exit(false, List<String>()); //clear list (uses memory)
}
+ // Now should be safe to delete MessageQueue (famous last words).
+ message_queue->flush();
+ memdelete(message_queue);
+
unregister_core_driver_types();
unregister_core_types();