-
-
Notifications
You must be signed in to change notification settings - Fork 23.6k
Fix crash on queue free scene node in editor #112401
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
Conversation
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.
We discussed this fix in the core meeting.
We agree that the approach you take (rejecting the object deletion in the editor only) is appropriate.
However, there are two changes I think are needed:
- Check for whether it's actually the editor via
Engine::get_singleton()->is_editor_hint(). Otherwise, the runtime using the editor binary will also reject the deletion, causing a discrepancy inDEBUGvsRELEASE. - Move this check to
node.cppin theNOTIFICATION_PREDELETEhandler, right after theis_main_threadcheck. This will prevent the same kind of bug when using.free()andmemdelete. You can reject deletion here usingcancel_free()(andreturn).
d1e853d to
759d3eb
Compare
|
Modified as suggestions. |
Ivorforce
left a comment
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.
Looks good to me, thanks for adjusting.
I tested that this new version still fixes the issue.
Update scene/main/node.cpp Co-authored-by: Lukas Tenbrink <[email protected]>
8c56226 to
63d1319
Compare
|
cc @lawnjelly ^ |
Generally the method I'm aiming for is this:
In this case though, this fix looks fairly easy to backport, if we've decided this is the best way of addressing it. 👍 |
|
Thanks! |
Issue Description
When we try to delete scene root node using
queue_freein editor, we will meet a crash. The marked node will be freed defer. But the editor still want to redraw relevant plugins for scene root node, then crashed.It is an abnormal behavior to delete a node in editor in
@toolannotated gdscript. If we delete a child node, we will see the child node disappeared from leftEditorTreeDockmenu. If we delete the root node, the scene cannot display normally.MRP
112171-1.zip
Solution
Prohibit
queue_clearto delete scene root node in editor.queue-free.webm