Main::cleanup: Move MessageQueue deletion further down where it's safer
Partial revert of #15702 which triggered the issue. Fixes #39786.
This commit is contained in:
parent
4c0b077faa
commit
6480efba45
|
@ -2321,8 +2321,8 @@ void Main::cleanup() {
|
||||||
ResourceLoader::remove_custom_loaders();
|
ResourceLoader::remove_custom_loaders();
|
||||||
ResourceSaver::remove_custom_savers();
|
ResourceSaver::remove_custom_savers();
|
||||||
|
|
||||||
|
// Flush before uninitializing the scene, but delete the MessageQueue as late as possible.
|
||||||
message_queue->flush();
|
message_queue->flush();
|
||||||
memdelete(message_queue);
|
|
||||||
|
|
||||||
OS::get_singleton()->delete_main_loop();
|
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)
|
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_driver_types();
|
||||||
unregister_core_types();
|
unregister_core_types();
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue