Fix quick-capture dialog controller disposal race

This commit is contained in:
Rijad Zuzo
2026-02-22 23:53:22 +01:00
parent 1f31a0e769
commit 05588cc58e
3 changed files with 181 additions and 58 deletions
+33
View File
@@ -7,6 +7,39 @@ Updated: 2026-02-22
- After every sensible code/documentation change set, create a git commit as
the last step so the next agent session can pick up from clean checkpoints.
## Latest Milestone (2026-02-22): Quick-Capture Dialog Controller Lifecycle Fix
Fixed a runtime crash when creating captures/notes from profile-context quick
actions (`TextEditingController was used after being disposed`) caused by a
dialog animation/disposal race.
- Root cause
- quick-capture dialogs in `People` and graph `Person Insights` created a
local `TextEditingController`, passed it into `showDialog(...)`, then
disposed it immediately after `await showDialog(...)`
- the dialog route can still rebuild during dismiss animation, which caused
the `TextField` to touch a disposed controller
- Fixes
- `lib/features/people/people_view.dart`
- replaced ad-hoc quick text capture dialog with stateful
`_QuickTextCaptureDialog` that owns and disposes its controller internally
- `lib/features/dashboard/dashboard_view.dart`
- replaced ad-hoc quick text capture dialog with stateful
`_InsightQuickTextCaptureDialog` with the same lifecycle fix
- both dialogs now also show inline `Required` validation instead of silent
no-op when pressing save with empty text
- Similar issue scan
- searched the codebase for the same anti-pattern (local
`TextEditingController` created outside dialog widget and disposed after
`showDialog`)
- no remaining occurrences found after patching these two flows
- Validation
- `flutter analyze` -> pass
- `flutter test` -> pass
## Latest Milestone (2026-02-22): Preference Review UI (People + Graph Insights)
Exposed the new chat-derived preference signals in the main person detail