Repository navigation
[Android] Fix FlyoutPage detail-swap fragment crash causing SwappingDetailPageWorksForSplitFlyoutBehavior device test failure on candidate branch #36169
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ExecutePendingTransactionsEx()call:1. Re-entrancy crash.
executePendingTransactions()throwsIllegalStateException: Recursive entry to executePendingTransactionsif the FragmentManager is already executing transactions — a hazard this repo already tracks (Bugzilla40333).ClearPlatformParts()runs from bothConnect()andDisconnect(), which are reachable from fragment-driven teardown (e.g. aModalNavigationManagerdismiss whose modal content is a FlyoutPage). TheIsDestroyed/IsStateSavedguards do not protect against this. If you keep the drain here, guard it:2. Global blast radius.
_mauiContext.GetFragmentManager()resolves to the activity-levelSupportFragmentManager, which is shared withStackNavigationManager, modal, and tabbed navigation.ExecutePendingTransactions()synchronously flushes every pending transaction app-wide — not just this FlyoutView's detailReplace— forcing unrelated fragment lifecycle work (e.g. an in-flight animated navigation) to run mid-teardown.The lower-risk, root-cause-aligned alternative is to settle the detail transaction in its owner (
FlyoutViewHandler), scoped to that one transaction, rather than a global drain fromNavigationRootManager.Flagged by: 3/3 reviewers (one rated the re-entrancy must-fix).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@PureWeen
Re-entrancy: I tried to reproduce the recursive
ExecutePendingTransactionscrash across multiple paths — modal FlyoutPage open/swap/dismiss, nested modals, and FlyoutPage → FlyoutPage root swaps (instrumented with a drain-depth counter). The drain was never re-entered, and I could not reproduce the crash. Based on this, no additional handling is being added for now.Global blast radius: Verified through
FragmentManageridentity logging that the modal path uses a scoped childFragmentManager, whileStackNavigationManageruses its own. In all tested scenarios, the drain never flushed unrelated navigation and only settled the FlyoutPage’s own pending detailReplace, so the effective scope remains limited.Based on the above validation, both concerns are currently considered low risk and are not being addressed in this fix.