-
-
Notifications
You must be signed in to change notification settings - Fork 21.3k
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
Prevent crash when calling set_text()
on a removed TreeItem
#86028
Prevent crash when calling set_text()
on a removed TreeItem
#86028
Conversation
This should be before updating the text IMO, in the relevant methods calling these methods Unless we can confirm it's valid and doesn't have strange sideeffects to update the text off the tree Also what about other methods like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would just raise a pointless error. It should be a normal if-check, not an error macro.
Also what about other methods like
TreeItem::_cell_selected
?
And indeed, other similar methods should also be updated with such checks.
Yes but there are too many places that might call |
516b67d
to
7a2831d
Compare
I don't think that's a valid argument against adding it there, but if you confirm that it's safe and doesn't cause any side effects to manipulate the text etc. not on the tree we can add it just to the places where For example, adding a item to the tree does not ensure |
Indeed, you are right. Does anyone familiar with this part of code and can give me some suggestions? |
A basic test would be to try your own code and see if there's any noticeable difference, if there isn't studying the code in more detail should help Edit: if it doesn't work I'd say each function that doesn't work should have an error fail saying something like "Manipulating TreeItem not in a tree is not supported." |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is good as is right now. I don't particularly see a reason to check places that call these methods. Changing items should be fine out of Tree
.
I'll trust that the manipulation of these is safe off the tree, despite the aspects mentioned above 🙂, but won't approve myself as I can't confirm it |
set_text()
on a removed TreeItem
set_text()
on a removed TreeItemset_text()
on a removed TreeItem
Thanks! |
Fixes #85650
Also, should I use add more description or just use
ERR_FAIL_NULL
is sufficent ?