diff options
Diffstat (limited to 'modules/gdnative/nativescript/nativescript.cpp')
-rw-r--r-- | modules/gdnative/nativescript/nativescript.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/modules/gdnative/nativescript/nativescript.cpp b/modules/gdnative/nativescript/nativescript.cpp index e9e3180835..f45217d031 100644 --- a/modules/gdnative/nativescript/nativescript.cpp +++ b/modules/gdnative/nativescript/nativescript.cpp @@ -835,12 +835,14 @@ NativeScriptLanguage::~NativeScriptLanguage() { for (Map<String, Ref<GDNative> >::Element *L = NSL->library_gdnatives.front(); L; L = L->next()) { - L->get()->terminate(); - NSL->library_classes.clear(); - NSL->library_gdnatives.clear(); - NSL->library_script_users.clear(); + if (L->get().is_valid()) + L->get()->terminate(); } + NSL->library_classes.clear(); + NSL->library_gdnatives.clear(); + NSL->library_script_users.clear(); + #ifndef NO_THREADS memdelete(mutex); #endif |