From 8aa022f99c0462805370d452ed9bb096941a440e Mon Sep 17 00:00:00 2001 From: Bastiaan Olij Date: Sat, 13 Feb 2021 23:41:39 +1100 Subject: [PATCH] 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 (cherry picked from commit ae7675065a3eebf2a61a5bdc5b5e103a7f869a78) --- 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 fd7ba3d30f9..5c0f8a74a0b 100644 --- a/modules/gdnative/nativescript/nativescript.cpp +++ b/modules/gdnative/nativescript/nativescript.cpp @@ -1530,7 +1530,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); }