summaryrefslogtreecommitdiff
path: root/modules/nativescript/nativescript.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/nativescript/nativescript.cpp')
-rw-r--r--modules/nativescript/nativescript.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/modules/nativescript/nativescript.cpp b/modules/nativescript/nativescript.cpp
index 493f21d75e..541fe951e4 100644
--- a/modules/nativescript/nativescript.cpp
+++ b/modules/nativescript/nativescript.cpp
@@ -958,7 +958,8 @@ void NativeReloadNode::_notification(int p_what) {
switch (p_what) {
case MainLoop::NOTIFICATION_WM_FOCUS_OUT: {
- print_line("unload");
+ if (unloaded)
+ break;
NSL->_unload_stuff();
for (Map<String, Ref<GDNative> >::Element *L = NSL->library_gdnatives.front(); L; L = L->next()) {
@@ -967,11 +968,14 @@ void NativeReloadNode::_notification(int p_what) {
NSL->library_classes.erase(L->key());
}
+ unloaded = true;
+
} break;
case MainLoop::NOTIFICATION_WM_FOCUS_IN: {
- print_line("load");
+ if (!unloaded)
+ break;
Set<StringName> libs_to_remove;
@@ -1010,6 +1014,8 @@ void NativeReloadNode::_notification(int p_what) {
}
}
+ unloaded = false;
+
for (Set<StringName>::Element *R = libs_to_remove.front(); R; R = R->next()) {
NSL->library_gdnatives.erase(R->get());
}