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

Fix for Exported typed variables in a tool script have wrong initial value if not initialized #92114

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Hilderin
Copy link
Contributor

@Hilderin Hilderin commented May 19, 2024

This should fix #62363

The problem was caused by member_default_values_cache not initialized for tool scripts. When not a tool script, a PlaceHolder is created and _update_exports was called. But _update_exports was not called on the creation of GDScriptInstance. Later when the scene or the script is saved, _update_exports is called fixing the issue after the first save. So to fix the problem, I added a call to _update_exports when the GDScriptInstance is created.

@Hilderin Hilderin requested a review from a team as a code owner May 19, 2024 11:28
@Hilderin Hilderin changed the title Fix for Exported typed variables in a tool script have wrong initial value if not initialized #62363 Fix for Exported typed variables in a tool script have wrong initial value if not initialized May 19, 2024
@AThousandShips AThousandShips added this to the 4.3 milestone May 19, 2024
@Hilderin
Copy link
Contributor Author

Hilderin commented May 19, 2024

Hi, can someone help me with the error from the CI pipeline for MacOS please?
I really have no clue what can be the problem and I don't have acces to a Mac, the Unit Tests pass on the other platforms but on MacOS, the build fail with this error:

TEST SUITE: [Modules][GDScript]
TEST CASE:  Script compilation and runtime

./modules/gdscript/tests/gdscript_test_runner_suite.h:43: FATAL ERROR: test case CRASHED: SIGSEGV - Segmentation violation signal

I found another PR #88452 talking about this error and wrapping code in #ifdef TOOLS_ENABLED but that code has this condition already.

Nevermind, after a good night of sleep, I figured it out, I just added if (Engine::get_singleton()->is_editor_hint()) before calling _update_exports.

@Hilderin Hilderin force-pushed the fix_default_value_not_initialized branch 4 times, most recently from 821fbab to bbf4498 Compare May 20, 2024 11:51
@Hilderin Hilderin force-pushed the fix_default_value_not_initialized branch from bbf4498 to 8bb249b Compare May 20, 2024 12:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Exported typed variables in a tool script have wrong initial value if not initialized
2 participants