Skip to content

fix(ui):keep destroy widgets out of the widget's active list - #19214

Merged
llsansun merged 1 commit into
cocos:v3.8.9from
LinYunMo:v3.8.9
Aug 26, 2026
Merged

llsansun merged 1 commit into
cocos:v3.8.9from
LinYunMo:v3.8.9

Conversation

@LinYunMo

Copy link
Copy Markdown
Contributor

Re: #18893
Cherry-pick‌ From: cocos/cocos4#302

Changelog

  • activeWidgets could keep widgets that have already been destroyed, so
    refreshScene called align() with widget.node === null (reset by
    CCObject._destruct) and threw every frame.
    Entries got in through visitNode, which collected widgets by widget.enabled
    alone - a flag that stays true after destroy(). Entries only got out through
    Widget.onDisable, which disableComp skips unless the component was enabled
    by the scheduler (IsOnEnableCalled).
    • visitNode now rejects widgets that are already marked for destruction.
    • Widget.onDestroy unregisters as well, covering widgets that were collected
      while still valid but never got onDisable.

Continuous Integration

This pull request:

  • needs automatic test cases check.

    Manual trigger with @cocos-robot run test cases afterward.

  • does not change any runtime related code or build configuration

    If any reviewer thinks the CI checks are needed, please uncheck this option, then close and reopen the issue.


Compatibility Check

This pull request:

  • changes public API, and have ensured backward compatibility with deprecated features.
  • affects platform compatibility, e.g. system version, browser version, platform sdk version, platform toolchain, language version, hardware compatibility etc.
  • affects file structure of the build package or build configuration which requires user project upgrade.
  • introduces breaking changes, please list all changes, affected features and the scope of violation.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

@LinYunMo
LinYunMo requested a review from llsansun August 25, 2026 09:45
@github-actions

Copy link
Copy Markdown

Code Size Check Report

Wechat (WASM) Before After Diff
2D Empty (legacy pipeline) 1009914 bytes 1009914 bytes ✅ 0 bytes
2D All (legacy pipeline) 2676381 bytes 2676447 bytes ⚠️ +66 bytes
2D All (new pipeline) 2768117 bytes 2768183 bytes ⚠️ +66 bytes
(2D + 3D) All 10025305 bytes 10025371 bytes ⚠️ +66 bytes
Web (WASM + ASMJS) Before After Diff
(2D + 3D) All 16845449 bytes 16845515 bytes ⚠️ +66 bytes

Interface Check Report

This pull request does not change any public interfaces !

@github-actions

Copy link
Copy Markdown

@LinYunMo, Please check the result of run test cases:

Task Details

@github-actions

Copy link
Copy Markdown

@LinYunMo, Please check the result of run test cases:

Task Details

@llsansun
llsansun merged commit 64f4c38 into cocos:v3.8.9 Aug 26, 2026
15 checks passed
star-e added a commit that referenced this pull request Aug 26, 2026
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