Skip to content

Fix #[var(pub)] panic during OnEditor<Gd<T>> reload#1639

Open
Bromeon wants to merge 1 commit into
masterfrom
bugfix/var-pub-hotreload
Open

Fix #[var(pub)] panic during OnEditor<Gd<T>> reload#1639
Bromeon wants to merge 1 commit into
masterfrom
bugfix/var-pub-hotreload

Conversation

@Bromeon

@Bromeon Bromeon commented Jun 16, 2026

Copy link
Copy Markdown
Member

The accessor registered with Godot now always goes through GodotConvert::Via instead of Var::PubType. Via is nullable for wrappers like OnEditor<Gd<T>>, so Godot-driven serialization (e.g. hot reload) reads an uninitialized field as null rather than panicking when unwrapping PubType.

The Rust-facing #[var(pub)] accessor still uses PubType (may panic on uninit, by design).

Fixes #1566.

@Bromeon Bromeon added bug c: core Core components labels Jun 16, 2026
The accessor registered with Godot now always goes through `GodotConvert::Via`
instead of `Var::PubType`. `Via` is nullable for wrappers like `OnEditor<Gd<T>>`,
so Godot-driven serialization (e.g. hot reload) reads an uninitialized field as
`null` rather than panicking when unwrapping `PubType`.

The Rust-facing `#[var(pub)]` accessor still uses `PubType` (may panic on uninit,
by design).
@Bromeon Bromeon force-pushed the bugfix/var-pub-hotreload branch from a41c820 to 7c22d8f Compare June 16, 2026 17:55
@GodotRust

Copy link
Copy Markdown

API docs are being generated and will be shortly available at: https://godot-rust.github.io/docs/gdext/pr-1639

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug c: core Core components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Combining #[var(pub)] and OnEditor<Gd<T>> for fields causes panic on hot reload

2 participants