fix: sign-out crash from disposed drawer context#6811
fix: sign-out crash from disposed drawer context#6811dawidvdh wants to merge 1 commit intoBasedHardware:mainfrom
Conversation
Greptile SummaryThis PR fixes a crash on sign-out by reordering the drawer close and dialog show operations. Previously, Confidence Score: 5/5Safe to merge — correctly fixes a real crash with no regressions introduced. The fix is minimal, targeted, and uses the correct Flutter pattern (show dialog while parent context is still mounted, dismiss both in the confirm callback). The only remaining note is a pre-existing P2 around the No files require special attention. Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant Drawer
participant Dialog
participant AuthService
Note over Drawer: Before fix (broken)
User->>Drawer: tap Sign Out
Drawer->>Drawer: navigator.pop() → context disposed ❌
Drawer->>Dialog: showDialog(context: disposed_ctx) → crash/silent fail
Note over Drawer: After fix
User->>Drawer: tap Sign Out
Drawer->>Dialog: showDialog(context: valid_ctx) ✅
User->>Dialog: tap Confirm
Dialog->>Dialog: Navigator.of(ctx).pop() — close dialog
Dialog->>Drawer: Navigator.of(context).pop() — close drawer
Dialog->>AuthService: SharedPreferencesUtil().clear()
Dialog->>AuthService: AuthService.instance.signOut()
Dialog->>Drawer: if (context.mounted) routeToPage(...) — likely false
|
Summary
navigator.pop()to close the drawerbefore
showDialog, disposing the drawer'scontextshowDialogthen used the dead context, causing either a silent failure or crashCloses #5652
I am not a flutter developer so this could be totally wrong but I was exploring this cool project and thought, ah lets try fix something minor, excuse and close if this is just noise.