summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastiaan Olij <mux213@gmail.com>2021-02-13 23:41:39 +1100
committerBastiaan Olij <mux213@gmail.com>2021-02-14 15:47:49 +1100
commitae7675065a3eebf2a61a5bdc5b5e103a7f869a78 (patch)
tree47c6480a366a628f4e6ec3bfd60d880f15872ee3
parentf0951537a49460052bb935edc37b0cc24e9545cf (diff)
Only unload the library when no NativeScript objects exist if the reloadable flag is true. If it is false it is likely the library does other things and can't be unloaded
-rw-r--r--modules/gdnative/nativescript/nativescript.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp
index 5880c69763..64fb8ee9c7 100644
--- a/modules/gdnative/nativescript/nativescript.cpp
+++ b/modules/gdnative/nativescript/nativescript.cpp
@@ -1728,7 +1728,7 @@ void NativeScriptLanguage::unregister_script(NativeScript *script) {
library_script_users.erase(S);
Map<String, Ref<GDNative>>::Element *G = library_gdnatives.find(script->lib_path);
- if (G) {
+ if (G && G->get()->get_library()->is_reloadable()) {
G->get()->terminate();
library_gdnatives.erase(G);
}