mirror of
https://github.com/Redot-Engine/redot-engine.git
synced 2025-12-06 07:17:42 -05:00
GDExtension: Always run shutdown callback before deinitializing any levels
This commit is contained in:
@@ -77,13 +77,6 @@ GDExtensionManager::LoadStatus GDExtensionManager::_unload_extension_internal(co
|
||||
emit_signal("extension_unloading", p_extension);
|
||||
#endif
|
||||
|
||||
if (level >= 0) { // Already initialized up to some level.
|
||||
// Deinitialize down from current level.
|
||||
for (int32_t i = level; i >= GDExtension::INITIALIZATION_LEVEL_CORE; i--) {
|
||||
p_extension->deinitialize_library(GDExtension::InitializationLevel(i));
|
||||
}
|
||||
}
|
||||
|
||||
if (!shutdown_callback_called) {
|
||||
// Extension is unloading before the shutdown callback has been called,
|
||||
// which means the engine hasn't shutdown yet but we want to make sure
|
||||
@@ -93,6 +86,13 @@ GDExtensionManager::LoadStatus GDExtensionManager::_unload_extension_internal(co
|
||||
}
|
||||
}
|
||||
|
||||
if (level >= 0) { // Already initialized up to some level.
|
||||
// Deinitialize down from current level.
|
||||
for (int32_t i = level; i >= GDExtension::INITIALIZATION_LEVEL_CORE; i--) {
|
||||
p_extension->deinitialize_library(GDExtension::InitializationLevel(i));
|
||||
}
|
||||
}
|
||||
|
||||
for (const KeyValue<String, String> &kv : p_extension->class_icon_paths) {
|
||||
gdextension_class_icon_paths.erase(kv.key);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user