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

Possible retain cycle on UIKit menu? #79

Open
Sega-Zero opened this issue Mar 18, 2023 · 4 comments
Open

Possible retain cycle on UIKit menu? #79

Sega-Zero opened this issue Mar 18, 2023 · 4 comments

Comments

@Sega-Zero
Copy link

I noticed that if I present a menu, dismiss it and then present it again - the last menu item doesn't working.
I tried to debug things and noticed that in Menu.swift the code:

 .onValueChange(of: model.selectedItemID) { _, newValue in

I get own itemID's that doesn't exist in the model. Like the old model of dismissed menu is still receiving this closure.
Also, if I change onValueChanged to

.onChange(of: model.selectedItemID, do: { selectedID in
    if selectedID == itemID {
        action()
    }
    model.selectedItemID = nil
})

everything works correctly.
I have a strong suspicion that ChangeObserver may have an unnecessary retain, but couldn't figure out that yet

Sega-Zero added a commit to Sega-Zero/Popovers that referenced this issue Mar 18, 2023
Sega-Zero added a commit to Sega-Zero/Popovers that referenced this issue Mar 18, 2023
@rafiqlightwala
Copy link

This fix impacts minimum version as it requires ios 14

@Sega-Zero
Copy link
Author

Sega-Zero commented Mar 20, 2023

it's not. It requires #78 to be merged. Anyway, current master is already uncompilable when targeting iOS 13

@rafiqlightwala
Copy link

I am using current master for ios13 just fine :/

@Sega-Zero
Copy link
Author

I couldn't build it, mentioned it in #77

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

2 participants