Skip to content

fix #17890: preview scene in editor should also destroy object at the end of the frame rendering#18157

Merged
dumganhar merged 1 commit into
cocos:v3.8.6from
minggo:fix-scene-preview
Jan 13, 2025
Merged

fix #17890: preview scene in editor should also destroy object at the end of the frame rendering#18157
dumganhar merged 1 commit into
cocos:v3.8.6from
minggo:fix-scene-preview

Conversation

@minggo

@minggo minggo commented Jan 10, 2025

Copy link
Copy Markdown
Contributor

#17890

As the modification shows, setTimeout(CCObject._deferredDestroy); may destroy object at any time. It doesn't promise to destroy objects at the end of the frame. Then other engine components may refer the an invalid object. Which is problem.

preview scene in editor will trigger the issue. So just destroy objects immediately only in editor mode. Editor doesn't use requestAnimationFrame to drive engine loop, it control the loop itself.

…same, or engine components may refer invalid nodes
@minggo
minggo requested a review from dumganhar January 10, 2025 10:15
@github-actions

Copy link
Copy Markdown

✅ Package size is not changed

Interface Check Report

This pull request does not change any public interfaces !

@dumganhar
dumganhar merged commit d655c30 into cocos:v3.8.6 Jan 13, 2025
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

Successfully merging this pull request may close these issues.

2 participants