summaryrefslogtreecommitdiff
path: root/modules/gdnative/nativescript
diff options
context:
space:
mode:
authorkarroffel <therzog@mail.de>2018-01-06 21:10:01 +0100
committerkarroffel <therzog@mail.de>2018-01-06 21:10:01 +0100
commit66eed7b85985529e54449cf87feee001cba0c759 (patch)
treeb0999c585e79aa1077309a2c859f640fcba96960 /modules/gdnative/nativescript
parent50b975548dcd65a9506e7fb449d40404320c0983 (diff)
[GDNative] fix reloading of non-reloadable libraries
Diffstat (limited to 'modules/gdnative/nativescript')
-rw-r--r--modules/gdnative/nativescript/nativescript.cpp9
-rw-r--r--modules/gdnative/nativescript/nativescript.h2
2 files changed, 8 insertions, 3 deletions
diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp
index 2d94599ea0..e9e3180835 100644
--- a/modules/gdnative/nativescript/nativescript.cpp
+++ b/modules/gdnative/nativescript/nativescript.cpp
@@ -790,8 +790,13 @@ NativeScriptInstance::~NativeScriptInstance() {
NativeScriptLanguage *NativeScriptLanguage::singleton;
-void NativeScriptLanguage::_unload_stuff() {
+void NativeScriptLanguage::_unload_stuff(bool p_reload) {
for (Map<String, Map<StringName, NativeScriptDesc> >::Element *L = library_classes.front(); L; L = L->next()) {
+
+ if (p_reload && !library_gdnatives[L->key()]->get_library()->is_reloadable()) {
+ continue;
+ }
+
for (Map<StringName, NativeScriptDesc>::Element *C = L->get().front(); C; C = C->next()) {
// free property stuff first
@@ -1108,7 +1113,7 @@ void NativeReloadNode::_notification(int p_what) {
#ifndef NO_THREADS
MutexLock lock(NSL->mutex);
#endif
- NSL->_unload_stuff();
+ NSL->_unload_stuff(true);
for (Map<String, Ref<GDNative> >::Element *L = NSL->library_gdnatives.front(); L; L = L->next()) {
Ref<GDNative> gdn = L->get();
diff --git a/modules/gdnative/nativescript/nativescript.h b/modules/gdnative/nativescript/nativescript.h
index 38f77aea55..ac94c84bc4 100644
--- a/modules/gdnative/nativescript/nativescript.h
+++ b/modules/gdnative/nativescript/nativescript.h
@@ -205,7 +205,7 @@ class NativeScriptLanguage : public ScriptLanguage {
private:
static NativeScriptLanguage *singleton;
- void _unload_stuff();
+ void _unload_stuff(bool p_reload = false);
#ifndef NO_THREADS
Mutex *mutex;