-
-
Notifications
You must be signed in to change notification settings - Fork 22.8k
Fix crash on treeitem free #108069
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
base: master
Are you sure you want to change the base?
Fix crash on treeitem free #108069
Conversation
Thanks for looking into this! I'm not sure this can be fixed in the engine, though. The crash in the issue is ultimately caused by the GDScript code freeing the node that ERR_FAIL_INDEX(p_col, p_selected->cells.size()); still accesses undefined memory via the now invalid I suppose if we wanted to add engine-side support to catch this, we could set a flag at the start of the iteration and throw an error if |
The crash happens in this loop: Lines 2984 to 2989 in 9b22b41
For some reason, it won't stop iterating when a TreeItem is selected, even though checking other items is pointless. |
The idea may be to iterate the entire tree to handle both selections and deselections (which may have to happen after the newly selected item). The crash is caused by a (user-defined) signal handler freeing the If |
Then ideally freeing TreeItems should be blocked inside that loop, but that might be not possible. Which leaves the current solution the only feasible one I suppose. |
I mean,
|
Ah yeah, this might work. |
Fix #107950