WeakReference in var for DragAndDropTarget


I use very often OwnedArrays. And for view classes I usually link them using WeakReferences.

Is it possible to do drag and drop (via DragAndDropTarget::SourceDetails::description) and hand over a WeakReference instead of a ReferenceCountedObject?

My design uses an OwnedArray and links with WeakReferences to the entities. It makes the ownership messy, if I change to ReferenceCountedObjects (at least to me).

Thanks for hints.


So I understand that the var class is not designed to carry references or SafePointers and I have to work around creating IDs and reference by strings or similar...


I can't quite decipher what you're trying to explain here, but you could always create a custom ReferenceCountedObject which contains a WeakReference, or a WeakReferencable object that contains a ReferenceCountedObjectPointer.. (?)


I'm sorry that I write sometimes a little cumbersome.

As I understand var acts as container for different types. One of them is a ReferenceCountedObject, which I didn't use yet, out of personal preference. But I do use WeakReferences a lot, so I hoped there is a way to put a WeakReference into a var container, which I simply overlooked.

So my question was, if this is possible. Otherwise I will have to take a closer look into ReferenceCountedObjects.

Thanks for your help.


The only custom type that a var can hold is a ReferenceCountedObject, but like I said, you could create one that holds a WeakReference (or anything else)