diff options
author | geekrelief <geekrelief@gmail.com> | 2020-12-23 06:23:41 -0800 |
---|---|---|
committer | geekrelief <geekrelief@gmail.com> | 2020-12-23 06:36:01 -0800 |
commit | cc5d8bb5adf46aef63828fb23095589e51cca783 (patch) | |
tree | dfff7a71dcb5084a21a70f76131b8bde11f20a0d /modules/gdnative/nativescript/nativescript.cpp | |
parent | 187be733aac2cb368ee23254d199ff4c71162701 (diff) | |
download | redot-engine-cc5d8bb5adf46aef63828fb23095589e51cca783.tar.gz |
Removes the gdnative library when no script (gdns) references it any longer. This enables hot reload for gdnative.
Diffstat (limited to 'modules/gdnative/nativescript/nativescript.cpp')
-rw-r--r-- | modules/gdnative/nativescript/nativescript.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp index 0939cfd06a..bb1f9dcf39 100644 --- a/modules/gdnative/nativescript/nativescript.cpp +++ b/modules/gdnative/nativescript/nativescript.cpp @@ -1724,6 +1724,12 @@ void NativeScriptLanguage::unregister_script(NativeScript *script) { S->get().erase(script); if (S->get().size() == 0) { library_script_users.erase(S); + + Map<String, Ref<GDNative>>::Element *G = library_gdnatives.find(script->lib_path); + if (G) { + G->get()->terminate(); + library_gdnatives.erase(G); + } } } #ifndef NO_THREADS |