You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-20 14:45:44 +00:00
Merge pull request #8743 from karroffel/gdnative-reload-fixes
[GDNative] fixed a reload bug
This commit is contained in:
@@ -99,15 +99,15 @@ Error NativeLibrary::terminate(NativeLibrary *&p_native_lib) {
|
|||||||
Error error = OK;
|
Error error = OK;
|
||||||
void *library_terminate;
|
void *library_terminate;
|
||||||
error = OS::get_singleton()->get_dynamic_library_symbol_handle(p_native_lib->handle, GDNativeScriptLanguage::get_terminate_symbol_name(), library_terminate);
|
error = OS::get_singleton()->get_dynamic_library_symbol_handle(p_native_lib->handle, GDNativeScriptLanguage::get_terminate_symbol_name(), library_terminate);
|
||||||
if (error)
|
if (!error) {
|
||||||
return OK; // no terminate? okay, not that important lol
|
|
||||||
|
|
||||||
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;
|
godot_native_terminate_options options;
|
||||||
options.in_editor = SceneTree::get_singleton()->is_editor_hint();
|
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);
|
GDNativeScriptLanguage::get_singleton()->initialized_libraries.erase(p_native_lib->path);
|
||||||
|
|
||||||
@@ -614,7 +614,6 @@ Error GDNativeLibrary::_terminate() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Error ret = NativeLibrary::terminate(native_library);
|
Error ret = NativeLibrary::terminate(native_library);
|
||||||
|
|
||||||
native_library->scripts.clear();
|
native_library->scripts.clear();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@@ -1217,6 +1216,7 @@ void GDNativeReloadNode::_notification(int p_what) {
|
|||||||
Set<GDNativeScript *> scripts;
|
Set<GDNativeScript *> scripts;
|
||||||
|
|
||||||
for (Set<GDNativeScript *>::Element *S = GDNativeScriptLanguage::get_singleton()->script_list.front(); S; S = S->next()) {
|
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())) {
|
if (lib->native_library->scripts.has(S->get()->get_script_name())) {
|
||||||
GDNativeScript *script = S->get();
|
GDNativeScript *script = S->get();
|
||||||
script->script_data = lib->get_script_data(script->get_script_name());
|
script->script_data = lib->get_script_data(script->get_script_name());
|
||||||
|
|||||||
Reference in New Issue
Block a user