Object Referencing and Object Question

Hey guys,

I have a custom canvas that has a custom object I’ve created as a property. I’ve recently released that it would be nice (i.e.: easy) in some of my code to store that custom canvas as a property of the custom object. Yes, I’ve created circular references here. So now I have made each referenced object a WeakRef.

Is this OK to do or is it considered bad form? I know I must use the WeakRef otherwise my objects can never be properly closed. And that’s fine. Just want to know if this is even considered OK to do (i.e.: is it akin to using GoTo?).


No, that’s exactly the way to do it. Use a computed property with a shadow property on the backend to make access easier.

Canvas has a Close event. Use regular references and in Close nil the property to break the cycle and it’ll all clean up. No need to juggle WeakRefs. Test this out though, I’m unable atm.