Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using GDNative, NativeScript::_update_placeholder: generates unhelpful error message about !script_data #42948

Closed
Tracked by #42719
geekrelief opened this issue Oct 20, 2020 · 7 comments

Comments

@geekrelief
Copy link
Contributor

Godot version:
3.2+

Issue description:
When using GDNative, placeholder scripts are used when the editor loses focus, and this error appears:

ERROR: _update_placeholder: Condition "!script_data" is true.
   At: modules/gdnative/nativescript/nativescript.cpp:92

I think it occurs when a library is unloaded. The failing condition doesn't seem to harm the execution of the app, and the error gives no clue as to how to resolve the error.

Questions about this error message come up repeatedly on Discord's gdnative-dev. Can we comment out this error check, come up with better messaging, and or document it in the GDNative docs?

The more gdnative libraries you have in your project the more of these errors are spammed, cluttering up the console output.

https://github.com/godotengine/godot/blob/master/modules/gdnative/nativescript/nativescript.cpp#L91-L106
Looking at the engine code, I'm not sure what this is supposed to do. script_data is not accessed in the function, and the error is not fatal.

Steps to reproduce:
Use gdnative, unfocus the editor, refocus the editor.

@Anutrix
Copy link
Contributor

Anutrix commented Oct 25, 2020

Should the two lines

NativeScriptDesc *script_data = get_script_desc();
ERR_FAIL_COND(!script_data);
really even be there?

@geekrelief
Copy link
Contributor Author

They don't seem to do anything. I just commented them out in my engine build. And everything seems to be working fine.

@geekrelief
Copy link
Contributor Author

Did some debugging and narrowed the issue. It's caused by using multiple libraries / dlls and unfocusing and refocusing the editor. https://github.com/godotengine/godot/blob/master/modules/gdnative/nativescript/nativescript.cpp#L1895-L1920
In this loop, the GDNative library is reloading and loops through NSL->library_script_users to update placeholders, but if another library was unloaded and its script is looped over the error is triggered.

I think the fix is to add a check inside of the library_script_users loop: if (L.key() != U.key()) continue;

@colugomusic
Copy link

Would be great if this could also be backported to 3.2. This message is so annoying that I am currently using a custom build with #43312 merged in.

@KoBeWi
Copy link
Member

KoBeWi commented May 8, 2022

This is already resolved in 4.0, no?

@KoBeWi KoBeWi moved this to To Assess in 4.x Priority Issues May 8, 2022
@akien-mga
Copy link
Member

Probably yes, since NativeScript is replaced by GDExtension in 4.0.

AFAICT it's not fixed in 3.x yet though, as the PR aiming to solve it was targeting the master branch and wasn't remade for 3.x: #46514.

@akien-mga
Copy link
Member

Fixed by #66255.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
6 participants