container: preserve user OnTappedBar when MultipleWindows wraps it - #6482
Open
LunatikDG wants to merge 1 commit into
Open
container: preserve user OnTappedBar when MultipleWindows wraps it#6482LunatikDG wants to merge 1 commit into
LunatikDG wants to merge 1 commit into
Conversation
setupChild() ran on every refreshChildren() (Add, RaiseToTop, Refresh) and unconditionally replaced InnerWindow.OnTappedBar with its own raise-to-top handler, discarding any callback the caller had already set. Wrap the existing callback once, guarded by a private flag on InnerWindow so repeated refreshes don't chain-wrap it. Fixes fyne-io#6433
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.
Description:
MultipleWindows.setupChild()runs on everyrefreshChildren()call — i.e. onAdd,RaiseToTopandRefresh— and unconditionally replacedInnerWindow.OnTappedBarwith its own raise-to-top handler. Any callback thecaller had already set on the window (before or after it was added) was
silently discarded, so setting
OnTappedBarbefore the window's first rendernever survived.
Fix: capture the existing
OnTappedBaronce and wrap it (user callback first,then the built-in raise-to-top), guarded by a private
tappedBarWrappedflagon
InnerWindowso repeatedRefresh()/Add()calls don't keep re-wrappingit into an ever-growing closure chain that would call the user's callback
multiple times per tap.
Fixes #6433
Scope note
InnerWindow.OnDragged/OnResizedare overwritten by the samesetupChild()in exactly the same way and have the identical latent bug — I left them out of
this PR to keep it scoped to the one reported symptom, and opened #6481 to
track fixing them separately.
Checklist:
Where applicable: