From d1ab5d371785635bfe401857370ac21dd0439dee Mon Sep 17 00:00:00 2001 From: Raul Santos Date: Mon, 3 Jun 2024 19:17:30 +0200 Subject: [PATCH] Release Engine before unregistering core types --- main/main.cpp | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/main/main.cpp b/main/main.cpp index af29e18c46e..e4ecbe64c7d 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -830,13 +830,15 @@ void Main::test_cleanup() { if (globals) { memdelete(globals); } - if (engine) { - memdelete(engine); - } unregister_core_driver_types(); unregister_core_extensions(); uninitialize_modules(MODULE_INITIALIZATION_LEVEL_CORE); + + if (engine) { + memdelete(engine); + } + unregister_core_types(); OS::get_singleton()->finalize_core(); @@ -2482,15 +2484,17 @@ error: if (globals) { memdelete(globals); } - if (engine) { - memdelete(engine); - } if (packed_data) { memdelete(packed_data); } unregister_core_driver_types(); unregister_core_extensions(); + + if (engine) { + memdelete(engine); + } + unregister_core_types(); OS::get_singleton()->_cmdline.clear(); @@ -4339,12 +4343,13 @@ void Main::cleanup(bool p_force) { unregister_core_driver_types(); unregister_core_extensions(); uninitialize_modules(MODULE_INITIALIZATION_LEVEL_CORE); - unregister_core_types(); if (engine) { memdelete(engine); } + unregister_core_types(); + OS::get_singleton()->benchmark_end_measure("Shutdown", "Total"); OS::get_singleton()->benchmark_dump();