summaryrefslogtreecommitdiff
path: root/modules/gdnative/gdnative.cpp
diff options
context:
space:
mode:
authorThomas Herzog <thomas.herzog@mail.com>2017-08-04 16:59:06 +0200
committerGitHub <noreply@github.com>2017-08-04 16:59:06 +0200
commitf79a5c464b95bdd274a4e9e5ff4713c7de2be011 (patch)
tree2de6933fe884096861ba7c86463639422b1b45c8 /modules/gdnative/gdnative.cpp
parent7ac50b523b8cb313245e2fbdd16b5561c88b3aeb (diff)
parentd71171026f321b635b93e1c4e026f791ff51d324 (diff)
Merge pull request #10085 from endragor/no-uninitialized-cb
Dont call nativescript callbacks if lib is not initialized
Diffstat (limited to 'modules/gdnative/gdnative.cpp')
-rw-r--r--modules/gdnative/gdnative.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp
index 158f7fd94d..07dba921b1 100644
--- a/modules/gdnative/gdnative.cpp
+++ b/modules/gdnative/gdnative.cpp
@@ -155,7 +155,6 @@ String GDNativeLibrary::get_active_library_path() const {
}
GDNative::GDNative() {
- initialized = false;
native_handle = NULL;
}
@@ -219,6 +218,9 @@ bool GDNative::initialize() {
library_init);
if (err || !library_init) {
+ OS::get_singleton()->close_dynamic_library(native_handle);
+ native_handle = NULL;
+ ERR_PRINT("Failed to obtain godot_gdnative_init symbol");
return false;
}
@@ -272,7 +274,11 @@ bool GDNative::terminate() {
OS::get_singleton()->close_dynamic_library(native_handle);
native_handle = NULL;
- return false;
+ return true;
+}
+
+bool GDNative::is_initialized() {
+ return (native_handle != NULL);
}
void GDNativeCallRegistry::register_native_call_type(StringName p_call_type, native_call_cb p_callback) {