Skip to content

Conversation

@Ivorforce
Copy link
Member

@Ivorforce Ivorforce commented Nov 6, 2025

WeakRef is a way to store a weak reference to an Object. It's implemented as a RefCounted subtype, because it can be useful for GDScript users (and otherwise).

However, as an Object subtype, it's also unnecessarily slow and wasteful. We shouldn't use it internally — notably, we currently don't use it internally at all. If we need a weak Object reference, we should be using something more performant. This 'something' could be proposed in a future PR, if it is needed (it would probably be a templated ObjectID wrapper).

Since there is no user of this class in the engine, it's trivial to move it to CoreBind. It was especially wrong to have it in ref_counted.h since it is usable not just for RefCounted, but for any Object subclass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant