On 07/22/2012 09:35 AM, Namespace wrote:
> A other question:
> How can i check if t is valid, after i call "clear"?

After the destructor is run, the object itself is put into a strange state. I amnot really sure about the actual details but I think the virtual function table is cleared (or perhaps just the destructor's entry?) so that the destructor is not going to be run again by the GC later.

Regarding the references to it, like 't' below, clear() cannot know about all of the references to the object. It could null the reference that is passed to it but apparently it doesn't do that maybe because null'ing one reference out of many wouldn't buy much.

Of course it is always possible to set it to null explicitly after calling clear():

 clear(t);
 t = null;

Because now we know that we shouldn't be using the local reference.

Ali

Reply via email to