From 66eed7b85985529e54449cf87feee001cba0c759 Mon Sep 17 00:00:00 2001 From: karroffel Date: Sat, 6 Jan 2018 21:10:01 +0100 Subject: [GDNative] fix reloading of non-reloadable libraries --- modules/gdnative/nativescript/nativescript.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'modules/gdnative/nativescript/nativescript.cpp') 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 >::Element *L = library_classes.front(); L; L = L->next()) { + + if (p_reload && !library_gdnatives[L->key()]->get_library()->is_reloadable()) { + continue; + } + for (Map::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 >::Element *L = NSL->library_gdnatives.front(); L; L = L->next()) { Ref gdn = L->get(); -- cgit v1.2.3