From 102d9fc1b395720dfb16097c7f9971808f21448b Mon Sep 17 00:00:00 2001 From: Anish Bhobe Date: Sun, 20 Feb 2022 11:41:39 +0100 Subject: [PATCH 1/2] Fixing iteration for extension level loading. Extensions are not getting instantiating properly due to iteration calling the wrong levels for loading. --- core/extension/native_extension_manager.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/extension/native_extension_manager.cpp b/core/extension/native_extension_manager.cpp index 87737858a83..f269056d142 100644 --- a/core/extension/native_extension_manager.cpp +++ b/core/extension/native_extension_manager.cpp @@ -46,8 +46,8 @@ NativeExtensionManager::LoadStatus NativeExtensionManager::load_extension(const 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)); + for (int32_t i = minimum_level; i <= level; i++) { + extension->initialize_library(NativeExtension::InitializationLevel(i)); } } native_extension_map[p_path] = extension; @@ -69,9 +69,9 @@ NativeExtensionManager::LoadStatus NativeExtensionManager::unload_extension(cons 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); From b7ff421b5553ea91e6f2ee5e69912b6ccb71b77f Mon Sep 17 00:00:00 2001 From: Anish Bhobe Date: Sun, 20 Feb 2022 14:56:58 +0100 Subject: [PATCH 2/2] Resolving suggestions on comment formatting. --- core/extension/native_extension_manager.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/core/extension/native_extension_manager.cpp b/core/extension/native_extension_manager.cpp index f269056d142..509405494bd 100644 --- a/core/extension/native_extension_manager.cpp +++ b/core/extension/native_extension_manager.cpp @@ -40,12 +40,12 @@ 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 + // Initialize up to current level. for (int32_t i = minimum_level; i <= level; i++) { extension->initialize_library(NativeExtension::InitializationLevel(i)); } @@ -64,12 +64,12 @@ NativeExtensionManager::LoadStatus NativeExtensionManager::unload_extension(cons Ref 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; } - // deinitialize down to current level + // Deinitialize down to current level. for (int32_t i = level; i >= minimum_level; i--) { extension->deinitialize_library(NativeExtension::InitializationLevel(i)); }