Repository navigation
fix(menu): title-bar menu dialogs open from the title bar's context (#1777) - #1780
Merged
Merged
Conversation
…context, not the closed menu item's (#1777) Preferences, Extensions, Driver Manager, About, Check for Updates, Command Palette and Go to Object took the menu item's own context. The menu is closed when the dialog opens a frame later, so the lookup threw "Looking up a deactivated widget's ancestor is unsafe".
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1777.
Problem
Choosing Edit → Preferences… threw
Looking up a deactivated widget's ancestor is unsafe:QueryaMenuItempasses its own context toonPressed, the menu is closed when the dialog opens a frame later, andshowAppDialoglooks upMaterialLocalizationson that dead element.Fix
The title bar's items that open a dialog or the palette (Command Palette, Go to Object, Preferences, Extensions, Driver Manager, About, Check for Updates) use the title bar's own
buildcontext, which stays mounted. The File items that only invoke anIntentare not changed.QueryaMenuItemitself is unchanged: other menus (connections panel, ERD, grid) pass the same kind of context toonPressedand may have the same problem; not checked here.Tests
New widget test taps Edit, then Preferences… with the real pointer path and expects the dialog and no exception. Without the fix it fails with the exact
deactivated widgeterror from the issue.Run:
test/features/main_screen/(114 tests, all pass),dart analyzeon the two files.