summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-02-21 12:44:32 +0100
committerGitHub <noreply@github.com>2022-02-21 12:44:32 +0100
commit3000a3076b00b59554d0b5500655c81080091b45 (patch)
treed736c804bf3e0af96278b660d18cd9518c1ab35d /core
parentadf10902c94cf259ce2cbd56d2835a70ee0d86b1 (diff)
parentb7ff421b5553ea91e6f2ee5e69912b6ccb71b77f (diff)
Merge pull request #58350 from kidrigger/patch-1
Diffstat (limited to 'core')
-rw-r--r--core/extension/native_extension_manager.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/core/extension/native_extension_manager.cpp b/core/extension/native_extension_manager.cpp
index 87737858a8..509405494b 100644
--- a/core/extension/native_extension_manager.cpp
+++ b/core/extension/native_extension_manager.cpp
@@ -40,14 +40,14 @@ NativeExtensionManager::LoadStatus NativeExtensionManager::load_extension(const
return LOAD_STATUS_FAILED;
}
- if (level >= 0) { //already initialized up to some level
+ if (level >= 0) { // Already initialized up to some level.
int32_t minimum_level = extension->get_minimum_library_initialization_level();
if (minimum_level < MIN(level, NativeExtension::INITIALIZATION_LEVEL_SCENE)) {
return LOAD_STATUS_NEEDS_RESTART;
}
- //initialize up to current level
- for (int32_t i = minimum_level; i < level; i++) {
- extension->initialize_library(NativeExtension::InitializationLevel(level));
+ // Initialize up to current level.
+ for (int32_t i = minimum_level; i <= level; i++) {
+ extension->initialize_library(NativeExtension::InitializationLevel(i));
}
}
native_extension_map[p_path] = extension;
@@ -64,14 +64,14 @@ NativeExtensionManager::LoadStatus NativeExtensionManager::unload_extension(cons
Ref<NativeExtension> extension = native_extension_map[p_path];
- if (level >= 0) { //already initialized up to some level
+ if (level >= 0) { // Already initialized up to some level.
int32_t minimum_level = extension->get_minimum_library_initialization_level();
if (minimum_level < MIN(level, NativeExtension::INITIALIZATION_LEVEL_SCENE)) {
return LOAD_STATUS_NEEDS_RESTART;
}
- //initialize up to current level
+ // Deinitialize down to current level.
for (int32_t i = level; i >= minimum_level; i--) {
- extension->deinitialize_library(NativeExtension::InitializationLevel(level));
+ extension->deinitialize_library(NativeExtension::InitializationLevel(i));
}
}
native_extension_map.erase(p_path);