Skip to content

fix: keep Linux fullscreen stable and preserve destination state on rotation - #13

Merged
BlackPool25 merged 1 commit into
mainfrom
fix/linux-fullscreen-crash
Aug 3, 2026
Merged

BlackPool25 merged 1 commit into
mainfrom
fix/linux-fullscreen-crash

Conversation

@BlackPool25

Copy link
Copy Markdown
Owner

What & Why

Two crash / state-loss bugs:

  1. Linux fullscreen crash. The qrstream/window channel handler in the Linux runner wrapped fl_method_call_get_args(...) in g_autoptr. But FlMethodCall owns that reference (fl_method_call_new refs it, dispose unrefs it) — get_args returns a borrowed pointer. g_autoptr double-unref'd it, tripping fl_value_unref's refcount assertion and corrupting the heap → the app crashed the moment Fullscreen was pressed. The args are now treated as the borrowed reference they are.

  2. Rotation resets the destination to home. The destination body sat at different element paths depending on width: body > Column on a portrait phone vs body > Row > Expanded > Column on landscape. Crossing the 600dp breakpoint (i.e. rotating a phone) therefore unmounted SendView/SettingsView and mounted fresh ones, discarding the picked file / settings form / send phase. The rail slot now always occupies index 0 (NavigationRail when wide, a zero-size placeholder when narrow) and the destination is fixed at index 1, so the element path is identical across the breakpoint and Flutter reuses the existing State instead of rebuilding it.

How it was tested

  • Fullscreen crash: reproduced the exact fl_value_unref CRITICAL + crash before the fix (running the app and triggering the channel). After the fix the app runs 12s+ with zero CRITICAL/assertion messages and no crash.

  • Rotation: new regression rotation across the 600dp breakpoint preserves the SendView State — pumps at 390dp, captures the State identity, resizes across 600dp both directions, asserts the same State survives. Fails on the old shell (State recreated: hash mismatch), passes on the new one.

  • cd flutter_app/rust && cargo build --lib && cd flutter_app && flutter analyze && flutter test — 118 tests pass.

  • flutter analyze + flutter test

  • Manually tested on: Flutter Linux (fullscreen no longer crashes)

Checklist

  • No wire-format/codec change
  • CHANGELOG / docs updated if user-facing
  • If AI-assisted, I reviewed and understood every line

…otation

- linux runner: the qrstream/window channel handler wrapped the args from
  fl_method_call_get_args in g_autoptr, but FlMethodCall owns that reference
  (fl_method_call_new refs it, dispose unrefs it) — g_autoptr double-unref'd
  it, tripping fl_value_unref's refcount assertion and crashing the app the
  moment Fullscreen was pressed. The args are now treated as the borrowed
  reference they are.
- app shell: the destination body moved between two Scaffold layouts at the
  600dp breakpoint (body>Column vs body>Row>Expanded>Column), so rotating a
  phone recreated SendView/SettingsView from scratch and reset their state.
  The rail slot now always occupies index 0 (NavigationRail when wide, a
  zero-size placeholder when narrow) with the destination fixed at index 1,
  keeping the element path stable across the breakpoint so Flutter reuses the
  existing State instead of rebuilding it.
@BlackPool25
BlackPool25 merged commit 44ecc33 into main Aug 3, 2026
2 checks passed
@BlackPool25
BlackPool25 deleted the fix/linux-fullscreen-crash branch August 3, 2026 11:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant