From ae7675065a3eebf2a61a5bdc5b5e103a7f869a78 Mon Sep 17 00:00:00 2001 From: Bastiaan Olij Date: Sat, 13 Feb 2021 23:41:39 +1100 Subject: 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 --- modules/gdnative/nativescript/nativescript.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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>::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); } -- cgit v1.2.3