Skip to content

fix: balance Texture2D image dependency references - #19226

Merged
star-e merged 1 commit into
cocos:v3.8.9from
Changdw:fix/texture2d-image-refcount
Sep 15, 2026
Merged

star-e merged 1 commit into
cocos:v3.8.9from
Changdw:fix/texture2d-image-refcount

Conversation

@Changdw

@Changdw Changdw commented Sep 14, 2026

Copy link
Copy Markdown
Contributor

Re: cocos/cocos4#267

Changelog

  • Backported the Texture2D image dependency reference-count fix to v3.8.9.
  • Fixed a reference-count leak when the preload dependency and _mipmaps dependency point to the same ImageAsset.
  • After image upload, removes every matching dependency edge and calls decRef() once for each removed edge.
  • Kept the cleanup behavior consistent between Web and JSB.
  • Added a focused regression test for duplicate ImageAsset dependency cleanup.

Known limitation:

  • Compressed textures containing multiple mip levels create derived ImageAsset instances. Releasing references held by the original source asset still requires further handling and is not covered by this backport.

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 the file structure of the build package or build configuration and requires a user project upgrade.
  • introduces breaking changes. If checked, list all changes, affected features, and the scope of the incompatibility.

(cherry picked from commit ff436d6a273b14195c3859336019fdf74e88c998)

@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.

@Changdw
Changdw requested a review from star-e September 14, 2026 10:14
@github-actions

Copy link
Copy Markdown

Code Size Check Report

Wechat (WASM) Before After Diff
2D Empty (legacy pipeline) 1009972 bytes 1009993 bytes ⚠️ +21 bytes
2D All (legacy pipeline) 2676439 bytes 2676460 bytes ⚠️ +21 bytes
2D All (new pipeline) 2768175 bytes 2768196 bytes ⚠️ +21 bytes
(2D + 3D) All 10025363 bytes 10025384 bytes ⚠️ +21 bytes
Web (WASM + ASMJS) Before After Diff
(2D + 3D) All 16845507 bytes 16845528 bytes ⚠️ +21 bytes

Interface Check Report

This pull request does not change any public interfaces !

@github-actions

Copy link
Copy Markdown

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

Task Details

@github-actions

Copy link
Copy Markdown

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

Task Details

@star-e
star-e merged commit 53bdac6 into cocos:v3.8.9 Sep 15, 2026
15 checks passed
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