Release Engine after unregistering GDExtensions

The Engine is used to retrieve singletons, and GDExtensions may try to retrieve a singleton (e.g.: `OS`) in their deinitialization.
This commit is contained in:
Raul Santos 2024-05-17 21:29:11 +02:00
parent bd2300d77a
commit e516479889
No known key found for this signature in database
GPG Key ID: B532473AE3A803E4
1 changed files with 4 additions and 3 deletions

View File

@ -4295,9 +4295,6 @@ void Main::cleanup(bool p_force) {
if (globals) {
memdelete(globals);
}
if (engine) {
memdelete(engine);
}
if (OS::get_singleton()->is_restart_on_exit_set()) {
//attempt to restart with arguments
@ -4315,6 +4312,10 @@ void Main::cleanup(bool p_force) {
uninitialize_modules(MODULE_INITIALIZATION_LEVEL_CORE);
unregister_core_types();
if (engine) {
memdelete(engine);
}
OS::get_singleton()->benchmark_end_measure("Shutdown", "Total");
OS::get_singleton()->benchmark_dump();