Hi Jules,
Would you mind adding a method to WeakReference::Master for knowing if it has an initialised SharedRef or not?
ie:
Somewhere in class WeakReference::Master:
bool hasSharedReferences() const { return sharedPointer != nullptr; }
Hi Jules,
Would you mind adding a method to WeakReference::Master for knowing if it has an initialised SharedRef or not?
ie:
Somewhere in class WeakReference::Master:
bool hasSharedReferences() const { return sharedPointer != nullptr; }
…why…? Can’t think of a use-case for that. Feels wrong to me.
In the scope of JUCE, I understand and agree…
With a custom multi-threaded rendering-style OpenGL component system, it’s fairly difficult to juggle weak references with such components that need to be copied to the rendering thread (or anything reference-counted that happens to be dangling)…
Its use case is debugging (for the most part); figured I wouldn’t be the only one who could need it!
Well, that actually won’t actually be correct anyway - that shared pointer is created, but never destroyed, so this could give a false positive.