On 21/01/2010 11:57, Michael Stahl wrote:
> i am not sure if a WeakReference would really help here... i guess it depends.
> in same-process C++ it should work.

actually, no.
somebody _else_ could also listen for the OnCreate or whatever event and
retain a hard reference. you cannot know whether this happens.
if it happens, that hard reference will keep the disposed instance alive.
so, the fact that a WeakReference can be converted to a hard reference is
no guarantee that the instance has not been disposed.

> regards, michael

-- 
"Debugging is twice as hard as writing the code in the first place.
 Therefore, if you write the code as cleverly as possible, you are, by
 definition, not smart enough to debug it." -- Brian Kernighan


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to