-
Notifications
You must be signed in to change notification settings - Fork 29
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
Fix deleting active combo #89
base: main
Are you sure you want to change the base?
Conversation
This is the ComboContainer before I stop rendering the active combo. We can see the I looked in the source code and couldn't see anywhere where My main concern with destroying the |
I just checked and it looks like Is that behavior guaranteed? If so, we should just be able to delete the Lines 217 to 223 in 46b26d4
which looks to be triggering the discard function. Unfortunately, we insert into the lastVdom viaLine 508 in 46b26d4
which makes it a k/v table, and so I believe we default to the generalized table iteration iteration semantics:
unfortunately I think this means we don't have a good way (right now) to delete the |
I see the issue. I discovered something similar before, where it would attempt to destroy a widget twice. That's why I added the I think you are right in stating that it was an oversight and a memory leak to not delete the |
In terms of fixing this, the Therefore, I think it is safe to continue deleting widgets in any order and update every |
I've added some extra checks and updated all of the ChildContainers, or differently-parented widgets, to properly destroy them. One thing that is bothering me is that we've never had to check before that a widget's instance still exists before deleting it. Logically, if we delete a parent and its instances, and then attempt to delete the child instance, it will error. Or is that just because it still has a reference to the Instance and Roblox allows us to call |
I've reverted the need to check for the But I've noticed a larger issue about discarding certain widgets which share a state. Currently, if a Menu or Tab is discarded, it won't update any others, even thought they work together. I've added extra checks which should properly update any others. However, I believe this introduces errors, since if we discard a parent and then destroy each child, the cleanup functions will assume that any siblings still exist, and therefore will attempt to use their instances, which have been destroyed. This is due to the state object updating any other widgets. Best way to solve this is to check within the state that the widget has not been destroyed. |
Closes #88
Took me a while to understand the way Iris renders the combo, but I'm fairly happy with this implementation. It solves the original issue and doesn't seem to cause problems for other combos.
I tested it with this script:
and the behavior is correct:
2025-01-04.13-59-27.mp4
my main concern is that the
ComboContainer
instance still exists underPlayerGui.PopupScreenGui
. It looks like Iris actually creates one of these per Combo. Ideally this instance gets destroyed -- we currently just make it invisible. I'm not sure what the consequences are of deleting it -- this is something I think should be discussed before merging.