Skip to content

Conversation

@wjt
Copy link
Member

@wjt wjt commented Jan 21, 2026

In order to duplicate a .tscn file, we load it as a PackedScene,
instantiate it, modify that instance, pack it, and save the new
PackedScene. Previously the instance was leaked. Free it.

This is not needed for any other types handled by this tool because
Resources are RefCounted; PackedScene is a Resource, but the instanced
scene is a Node which is not a RefCounted.

In order to duplicate a .tscn file, we load it as a PackedScene,
instantiate it, modify that instance, pack it, and save the new
PackedScene. Previously the instance was leaked. Free it.

This is not needed for any other types handled by this tool because
Resources are RefCounted; PackedScene is a Resource, but the instanced
scene is a Node which is not a RefCounted.
@wjt wjt requested a review from a team as a code owner January 21, 2026 17:57
@github-actions
Copy link

Play this branch at https://play.threadbare.game/branches/endlessm/wjt/storyquest-bootstrap-free-scenes-after-duplicating-them.

(This launches the game from the start, not directly at the change(s) in this pull request.)

@wjt wjt merged commit 465d07e into main Jan 21, 2026
6 checks passed
@wjt wjt deleted the wjt/storyquest-bootstrap-free-scenes-after-duplicating-them branch January 21, 2026 18:20
result = ResourceSaver.save(copied)
assert(result == OK, error_string(result))

scene.free()
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

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.

3 participants