Fix dispose() context.read assertion in blender_lines_panel.dart #28

Open
opened 2026-08-12 12:42:37 +00:00 by ImBenji · 0 comments
Owner

Same anti-pattern that #16 fixed in lib/widgets/lines_panel_v2.dart has reappeared in lib/pages/blender/blender_lines_panel.dart, which is now the active editor under Blender Mode.

dispose() calls a commit helper that calls context.read() directly, guarded only by mounted (which doesn't prevent "Looking up a deactivated widget's ancestor is unsafe"):

  • _ActiveLineNameField.dispose() (~line 444) -> _commit() (line 457) -> context.read
    • another State's dispose() (~line 601) -> _commitWidth()/_commitPadding() -> _update() (line 663) -> context.read
      Fix the same way #16 was fixed: cache the dependency earlier (initState/didChangeDependencies) instead of looking it up in dispose.

Acceptance: no assertion when rapidly opening/closing the panel or switching tools.

Same anti-pattern that #16 fixed in lib/widgets/lines_panel_v2.dart has reappeared in lib/pages/blender/blender_lines_panel.dart, which is now the active editor under Blender Mode. dispose() calls a commit helper that calls context.read<MapDataProvider>() directly, guarded only by `mounted` (which doesn't prevent "Looking up a deactivated widget's ancestor is unsafe"): - _ActiveLineNameField.dispose() (~line 444) -> _commit() (line 457) -> context.read - - another State's dispose() (~line 601) -> _commitWidth()/_commitPadding() -> _update() (line 663) -> context.read Fix the same way #16 was fixed: cache the dependency earlier (initState/didChangeDependencies) instead of looking it up in dispose. Acceptance: no assertion when rapidly opening/closing the panel or switching tools.
ImBenji added the bugarea:ui/ux labels 2026-08-12 12:42:37 +00:00
ImBenji added this to the Arcs & Angles project 2026-08-12 12:42:37 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: IMBENJI.NET/Metro-Map-Maker#28