Skip to content

fix(rendering): update BlitDesc.blit on reuse to prevent stale-reference crash#19166

Open
YW1975 wants to merge 2 commits intococos:v3.8.8from
YW1975:fix/blit-desc-stale-ref-18884
Open

fix(rendering): update BlitDesc.blit on reuse to prevent stale-reference crash#19166
YW1975 wants to merge 2 commits intococos:v3.8.8from
YW1975:fix/blit-desc-stale-ref-18884

Conversation

@YW1975
Copy link
Copy Markdown

@YW1975 YW1975 commented Apr 17, 2026

Summary

Changes

  • cocos/rendering/custom/executor.ts:618-625 — update _blitDesc.blit on reuse
  • tests/rendering/blit-desc-stale-ref.test.ts — verification test proving BROKEN crashes and FIXED succeeds

Test plan

  • Verification test: npx ts-node --skip-project tests/rendering/blit-desc-stale-ref.test.ts → 6/6 pass
  • Regression: npx jest → no new failures (163/163 = 162 pre-existing + 1 new file, all blocked by unrelated external:emscripten mapping)
  • Manual: open CocosBag repro project in Cocos Creator 3.8.8, load TestGarbage.scene, confirm no localSetLayout crash

🤖 Generated with Claude Code

…nce crash (cocos#18884)

When DeviceRenderQueue.createBlitDesc() reused an existing _blitDesc,
it did not update the stored blit reference. This caused
BlitDesc.createStageDescriptor() to read a stale Blit whose
material/passID could be invalid, resulting in "Cannot read
'localSetLayout' of undefined" — an infinite error loop that froze
the editor.

The fix updates this._blitDesc.blit = blit in the reuse path before
calling createScreenQuad() and createStageDescriptor().

Closes cocos#18884

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 17, 2026

Code Size Check Report

Wechat (WASM) Before After Diff
2D Empty (legacy pipeline) 1009738 bytes 1009738 bytes ✅ 0 bytes
2D All (legacy pipeline) 2675347 bytes 2675347 bytes ✅ 0 bytes
2D All (new pipeline) 2767083 bytes 2767095 bytes ⚠️ +12 bytes
(2D + 3D) All 10024081 bytes 10024093 bytes ⚠️ +12 bytes
Web (WASM + ASMJS) Before After Diff
(2D + 3D) All 16843143 bytes 16843155 bytes ⚠️ +12 bytes

Interface Check Report

This pull request does not change any public interfaces !

The standalone ts-node script caused CI npm_test to fail with
"Your test suite must contain at least one test". Rewritten using
describe/test/expect to match the project's jest convention.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

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

Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.

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.

Endless editor error after loading the scene ([Scene] Cannot read properties of undefined (reading 'localSetLayout'))

1 participant