Move WeakRef to CoreBind, since it shouldn't be (and isn't) used internally
#112470
+54
−52
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.
WeakRefis a way to store a weak reference to anObject. It's implemented as aRefCountedsubtype, because it can be useful forGDScriptusers (and otherwise).However, as an
Objectsubtype, 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 weakObjectreference, 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 templatedObjectIDwrapper).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 inref_counted.hsince it is usable not just forRefCounted, but for anyObjectsubclass.