[fix] clear property-usage refs when objects are removed (incl. scene deletion)#3076
Open
205sla wants to merge 1 commit into
Open
[fix] clear property-usage refs when objects are removed (incl. scene deletion)#3076205sla wants to merge 1 commit into
205sla wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds cleanup of variable/message/function references when an object is removed, preventing stale references from lingering in the variable container UI/state.
Changes:
- Introduced
VariableContainer.removeRefs(objectId)to purge ref entries tied to a removed object. - Updated object removal flow to capture
object.idbeforedestroy()and invoke both local variable cleanup and ref cleanup.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| src/class/variable_container.js | Adds removeRefs() to filter out refs connected to a removed object and refresh the list in non-default view modes. |
| src/class/container.js | Ensures object id is captured pre-destroy and triggers removeRefs() after object removal. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+3262
to
+3266
| ['_variableRefs', '_messageRefs', '_functionRefs'].forEach((type) => { | ||
| this[type] = this[type].filter( | ||
| (ref) => !ref.object || ref.object.id !== objectId | ||
| ); | ||
| }); |
| (ref) => !ref.object || ref.object.id !== objectId | ||
| ); | ||
| }); | ||
| Entry.playground.viewMode_ !== 'default' && this.updateList(); |
5981902 to
7fc6053
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
오브젝트를 삭제할 때 변수/리스트/신호/함수 속성 패널의 "사용된 오브젝트" 목록에서 해당 오브젝트가 사라지지 않는 버그를 수정합니다.
Entry.VariableContainer의 사용처 ref 배열(_variableRefs, _messageRefs, _functionRefs)에서 삭제된 오브젝트의 ref를 제거합니다. 오브젝트를 직접 삭제하는 경우와 장면 삭제로 오브젝트가 함께 제거되는 경우를 모두 처리합니다.
Why
변수/리스트/신호/함수 속성 패널은 위 세 ref 배열을 기반으로 "이 속성을 사용하는 오브젝트"를 표시합니다.
블록을 삭제하면 dataDestroy 이벤트가 removeRef()를 호출하므로 사용처 ref가 정상적으로 제거됩니다. 그러나 오브젝트를 직접 삭제하거나, 장면 삭제가 removeObject(object, true)로 그 장면의 오브젝트를 제거하는 경우에는 오브젝트의 스크립트 블록이 destroy되지 않아 dataDestroy가 발생하지 않습니다. 이때 삭제된 오브젝트의 ref가 배열에 그대로 남아, 이미 없는 오브젝트가 사용처 목록에 계속 표시되고 오브젝트/블록 참조가 메모리에 살아남습니다.
Implementation
범위:
test video: YouTube