Skip to content

Commit

Permalink
Fix for Exported typed variables in a tool script have wrong initial …
Browse files Browse the repository at this point in the history
…value if not initialized #62363
  • Loading branch information
Hilderin committed May 20, 2024
1 parent daa81bb commit 8bb249b
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions modules/gdscript/gdscript.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,16 @@ GDScriptInstance *GDScript::_create_instance(const Variant **p_args, int p_argco
ERR_FAIL_V_MSG(nullptr, "Error constructing a GDScriptInstance: " + error_text);
}
}

#ifdef TOOLS_ENABLED
// Update exports to have the correct default values for tool scripts on editor startup.
// Should be called in the editor only, otherwise it crashes macOS unit tests
// with a 'Segmentation violation signal' because of missing instance state support.
if (Engine::get_singleton()->is_editor_hint()) {
_update_exports(nullptr, false, nullptr);
}
#endif

//@TODO make thread safe
return instance;
}
Expand Down

0 comments on commit 8bb249b

Please sign in to comment.