Merge pull request #77633 from MarioLiebisch/core-type-free-order

Properly free core types in reverse order
This commit is contained in:
Yuri Sizov 2023-05-30 18:11:58 +02:00 committed by GitHub
commit 6101240231
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 15 deletions

View File

@ -365,21 +365,28 @@ void unregister_core_extensions() {
void unregister_core_types() {
OS::get_singleton()->benchmark_begin_measure("unregister_core_types");
// Destroy singletons in reverse order to ensure dependencies are not broken.
memdelete(worker_thread_pool);
memdelete(_engine_debugger);
memdelete(_marshalls);
memdelete(_classdb);
memdelete(_engine);
memdelete(_os);
memdelete(_resource_saver);
memdelete(_resource_loader);
memdelete(_geometry_3d);
memdelete(_geometry_2d);
memdelete(gdextension_manager);
memdelete(resource_uid);
memdelete(_resource_loader);
memdelete(_resource_saver);
memdelete(_os);
memdelete(_engine);
memdelete(_classdb);
memdelete(_marshalls);
memdelete(_engine_debugger);
memdelete(_geometry_2d);
memdelete(_geometry_3d);
memdelete(worker_thread_pool);
if (ip) {
memdelete(ip);
}
ResourceLoader::remove_resource_format_loader(resource_format_image);
resource_format_image.unref();
@ -410,10 +417,6 @@ void unregister_core_types() {
ResourceLoader::remove_resource_format_loader(resource_loader_json);
resource_loader_json.unref();
if (ip) {
memdelete(ip);
}
ResourceLoader::remove_resource_format_loader(resource_loader_gdextension);
resource_loader_gdextension.unref();