Skip to content
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

[iOS] App crash when an element is removed from its parent layout #97

Open
Santiago5050 opened this issue Nov 28, 2023 · 2 comments
Open

Comments

@Santiago5050
Copy link

Exception "MauiContext should have been set on parent" when removing a child from its parent layout on iOS

Description:
When a child is removed from its parent layout on iOS, an exception "MauiContext should have been set on parent" is thrown. Upon investigation, it seems that the issue arises during the cleanup process by Maui when attempting to clean a child that has already been cleaned by Mopups.

Proposed Solution:
To address this issue, I suggest stopping listening the 'DescendantRemoved' event and the child handler cleanup in the iOS implementation of IPopupPlatform. By doing so, Maui will be able to properly handle the cleanup of the removed view.

Environment:

  • Platform: iOS
  • .NET Version: 8.0.0
  • Mopups Version: 1.0.2
  • Maui Version: 8.0.3

Repro
ReproMopups.zip

Steps to reproduce

  1. Run the solution in an iOS device.
  2. Tap the 'Open popup' button.
  3. Tap the 'Add/Remove label' button.
    A label will be added with the first tap, but after the second the app will crash trying to remove the label from its parent layout.
@Tamilarasan-Paranthaman
Copy link

Are there any updates regarding this issue?

@microspaze
Copy link

The same issue in RGPopup.Maui:
microspaze/RGPopup.Maui#6

The fix commits:
microspaze/RGPopup.Maui@a64a99d
microspaze/RGPopup.Maui@62ac001

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants