Skip to content

Conversation

@dsnopek
Copy link
Collaborator

@dsnopek dsnopek commented Oct 28, 2025

Tweens are an interesting case, because Node::create_tween() will return the new Tween, but also adds it to an internal list that will lead to it being processed later and eventually cleaned up.

If we have an issue with handling RefCounted, we may miss it on a simple function that just returns a RefCounted, but doesn't maintain another reference.

Node::create_tween() is also a fairly common method, so this is a good smoke test to have!

(Note: This test would have helped with godotengine/godot#86079)

@dsnopek dsnopek added this to the 4.x milestone Oct 28, 2025
@dsnopek dsnopek requested a review from a team as a code owner October 28, 2025 16:40
@dsnopek dsnopek added the enhancement This is an enhancement on the current functionality label Oct 28, 2025

bool Example::test_tween_smoke_test() {
Ref<Tween> tween = create_tween();
return tween.is_valid() && tween->is_class("Tween") && tween->get_reference_count() > 1;
Copy link
Member

Choose a reason for hiding this comment

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

I assume > 1 means "1 reference by this function, one by the tween owner"?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes. In current Godot the reference count is 2, one for this function and the other is SceneTree::tweens

@dsnopek dsnopek merged commit fde93df into godotengine:master Oct 29, 2025
16 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement This is an enhancement on the current functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants