<div dir="ltr">Hi,<br><br>I had a similar issue. I simply checked whether there was any interaction with the vtkContourWidget. I did this by checking whether the contour widget&#39;s representation has a valid data pointer. This allowed me to verify the widget&#39;s existence. <br>
<br>Hope this helps,<br><br>Prathamesh<br><br>------------------------------<br>
<br>
Message: 6<br>
Date: Wed, 7 Jul 2010 09:50:24 +0200<br>
From: &quot;Barth, Sebastian&quot; &lt;<a href="mailto:sebastian.barth@iosb.fraunhofer.de">sebastian.barth@iosb.fraunhofer.de</a>&gt;<br>
Subject: Re: [vtkusers] object existence<br>
To: Haider Syed &lt;<a href="mailto:hsyed88@yahoo.com">hsyed88@yahoo.com</a>&gt;,
 &quot;<a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>&quot;<br>
        &lt;<a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a>&gt;<br>
Message-ID:<br>
        &lt;<div id=":25" class="ii gt">350EDD93E99EC240BD736766AD0E9008021C5DA604@MS3EXCHANGE.ms3.corp&gt;<br>
Content-Type: text/plain; charset=&quot;us-ascii&quot;<br>
<br>
Hello,<br>
<br>
I don&#39;t know if it is possible. You can call GetReferenceCount() but 
this will cause an application crash if the objects does not exist.<br>
Anyway, you normally should not come into the situation where you have 
to check, if a reference you hold is still existing.<br>
<br>
I&#39;m also still confused by the garbage collection of VTK.<br>
<br>
vtkObjectBase::New() will create and return a new instance of vtkObject 
with a reference count of 1 (vtk assumes that you are holding a 
reference to this object in the current scope).<br>
<br>
If you now assign this object to another vtkObjectBase, its reference 
count will be increased by 1 to 2.<br>
<br>
If you now call Delete() or Unregister(int) (I still don&#39;t know for what
 the parameter is used for) the reference count is decreased by 1 but 
the object is NOT deleted since its reference count is still higher than
 0 (it&#39;s 1).<br>
<br>
I could not find a difference between Delete() and Unregister(int) apart
 of the parameter that seems not to be used (or I am too stupid to read 
the code).<br>
<br>
Register() increases the reference count of an object.<br>
Normally, all set, add, append, and remove methods in VTK should use 
these functions by default.<br>
<br>
Hope this helps.<br>
Correct me if I am wrong.<br>
<br>
Sebastian Barth<br>
<br>
Von: <a href="mailto:vtkusers-bounces@vtk.org">vtkusers-bounces@vtk.org</a>
 [mailto:<a href="mailto:vtkusers-bounces@vtk.org">vtkusers-bounces@vtk.org</a>]
 Im Auftrag von Haider Syed<br>
Gesendet: Dienstag, 6. Juli 2010 16:52<br>
An: <a href="mailto:vtkusers@vtk.org">vtkusers@vtk.org</a><br>
Betreff: [vtkusers] object existence<br>
<br>
Hi,<br>
<br>
I have an instance of vtkContourWidget declared, call it cwidget.  I 
have a delete button for this instance and I need to check if the 
instance exists or not.  How can I check if cwidget exists or not.  This
 may have something to do with reference counting but I don&#39;t understand
 this concept fully....<br>
<br>
<br>
<br>
-------------- next part --------------<br>
An HTML attachment was scrubbed...<br>
URL: &lt;<a href="http://www.vtk.org/pipermail/vtkusers/attachments/20100707/85755d7b/attachment-0001.htm" target="_blank">http://www.vtk.org/pipermail/vtkusers/attachments/20100707/85755d7b/attachment-0001.htm</a>&gt;<br>

<br>
------------------------------</div></div>