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
|
|
nvm man btw do you have any chance to test it? |
|
Thanks for the PR, was fixed in one of my recent PRs |
|
Hey @dawidvdh 👋 Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request. After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:
Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out. Thank you for being part of the Omi community! 💜 |
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.