Skip to content

Conversation

@PureWeen
Copy link
Member

@PureWeen PureWeen commented Jul 2, 2024

Description of Change

There might be scenarios where users are watching when views are removed from the visual tree and then disconnecting the handler. This accounts for those scenarios.

Ideally, we should make the operation of removing and adding a view somewhat atomic. It feels a little bit off that we fire "DecendentRemoved/Added" on Element before removing the platformview from the platform layout.

I think this change is useful either way, as it just makes the code path a bit more robust.

One thing to note about
#23278

Having attached behaviors that call DisconnectHandler on everything when they leave the visual tree probably still has a few gotcha scenarios. If Mopups wants to retain that behavior, I would recommend that they dispatch that disconnect on the UI Thread after things have been cleaned up a bit so they can ensure nothing inside MAUI still needs that handler.

Issues Fixed

Fixes #23278

tj-devel709
tj-devel709 previously approved these changes Jul 2, 2024
Copy link
Member

@tj-devel709 tj-devel709 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@PureWeen
Copy link
Member Author

PureWeen commented Jul 3, 2024

/rebase

1 similar comment
@PureWeen
Copy link
Member Author

PureWeen commented Jul 3, 2024

/rebase

mattleibow
mattleibow previously approved these changes Jul 4, 2024
@PureWeen PureWeen enabled auto-merge (squash) July 4, 2024 15:38
@PureWeen PureWeen merged commit a4b1044 into main Jul 4, 2024
@PureWeen PureWeen deleted the fix_23278 branch July 4, 2024 22:13
PureWeen added a commit that referenced this pull request Jul 5, 2024
github-actions bot pushed a commit that referenced this pull request Jul 5, 2024
PureWeen added a commit that referenced this pull request Jul 5, 2024
* Revert "If PlatformView has been removed use index (#23408)"

This reverts commit a4b1044.

* Delete src/Core/src/Handlers/Layout/LayoutHandler.Mac.cs
@samhouts samhouts added fixed-in-8.0.70 fixed-in-net9.0-nightly This may be available in a nightly release! labels Aug 2, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Sep 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

fixed-in-8.0.70 fixed-in-net9.0-nightly This may be available in a nightly release!

Projects

None yet

Development

Successfully merging this pull request may close these issues.

iOS CarouselView crashes with "MauiContext should have been set on parent."

6 participants