summaryrefslogtreecommitdiff
path: root/modules/gdnative
diff options
context:
space:
mode:
authorKarroffel <therzog@mail.de>2017-05-13 14:37:57 +0200
committerKarroffel <therzog@mail.de>2017-05-13 14:37:57 +0200
commit11e496d99a5d49044769c663304b5f24d7e18096 (patch)
tree2058dc3acb571df87249ddfabfd2f9e4cef54e31 /modules/gdnative
parente883cdafa6f3b98d1f30e555aed0044782f6a5c4 (diff)
[GDNative] fixed a reload bug
When there was no terminate function defined in the library the exported variables would not update. This fixes that.
Diffstat (limited to 'modules/gdnative')
-rw-r--r--modules/gdnative/gdnative.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/modules/gdnative/gdnative.cpp b/modules/gdnative/gdnative.cpp
index e74d601d74..9c8625c1e0 100644
--- a/modules/gdnative/gdnative.cpp
+++ b/modules/gdnative/gdnative.cpp
@@ -99,15 +99,15 @@ Error NativeLibrary::terminate(NativeLibrary *&p_native_lib) {
Error error = OK;
void *library_terminate;
error = OS::get_singleton()->get_dynamic_library_symbol_handle(p_native_lib->handle, GDNativeScriptLanguage::get_terminate_symbol_name(), library_terminate);
- if (error)
- return OK; // no terminate? okay, not that important lol
+ if (!error) {
- void (*library_terminate_pointer)(godot_native_terminate_options *) = (void (*)(godot_native_terminate_options *))library_terminate;
+ void (*library_terminate_pointer)(godot_native_terminate_options *) = (void (*)(godot_native_terminate_options *))library_terminate;
- godot_native_terminate_options options;
- options.in_editor = SceneTree::get_singleton()->is_editor_hint();
+ godot_native_terminate_options options;
+ options.in_editor = SceneTree::get_singleton()->is_editor_hint();
- library_terminate_pointer(&options);
+ library_terminate_pointer(&options);
+ }
GDNativeScriptLanguage::get_singleton()->initialized_libraries.erase(p_native_lib->path);
@@ -614,7 +614,6 @@ Error GDNativeLibrary::_terminate() {
}
Error ret = NativeLibrary::terminate(native_library);
-
native_library->scripts.clear();
return ret;
@@ -1217,6 +1216,7 @@ void GDNativeReloadNode::_notification(int p_what) {
Set<GDNativeScript *> scripts;
for (Set<GDNativeScript *>::Element *S = GDNativeScriptLanguage::get_singleton()->script_list.front(); S; S = S->next()) {
+
if (lib->native_library->scripts.has(S->get()->get_script_name())) {
GDNativeScript *script = S->get();
script->script_data = lib->get_script_data(script->get_script_name());