<html><body bgcolor="#FFFFFF"><div>Hv u tried using vtkSmartpointers instead of "Common"pointers? When using them u don't hv to Care about deleting Pointers.&nbsp;<br><br>Am 19.12.2010 um 12:12 schrieb Ragu Vijaykumar &lt;<a href="mailto:ragu@myosight.org">ragu@myosight.org</a>&gt;:<br><br></div><div></div><blockquote type="cite"><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; color: rgb(113, 49, 168); "><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">H</span>i all,</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; color: rgb(113, 49, 168); "><span style="color: #000000"><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; color: rgb(113, 49, 168); "><span style="color: #000000">This is my first time posting to this list, so I hope someone out there can help me. I have the following code that needs to create a model that I will specify. I am using VTK 5.6.1 under OSX 10.6.5 with Cocoa build and RelWithDebInfo, linked with Qt 4.7, and&nbsp;</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">VTK_REQUIRED_OBJCXX_FLAGS:STRING=""</span>&nbsp;to get it to work with Qt.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; ">The issue lies with the SetPoints method, which seems to automatically delete the parameter 'Points'. I stepped through the debugger, and it shows that the method makes points reference count 0 from 1, while the fielddata and cells lines all work as expected. My program crashes on 'points-&gt;Delete' everytime, and I'm not sure why?</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre"><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre"><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; color: rgb(113, 49, 168); "><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">        </span></span>vtkPolyData<span style="color: #000000">* model = </span>vtkPolyData<span style="color: #000000">::</span><span style="color: #400c80">New</span><span style="color: #000000">();</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">        </span><span style="color: #7131a8">cout</span> &lt;&lt;&nbsp;model-&gt;<span style="color: #400c80">GetPoints</span>() &lt;&lt; endl;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; min-height: 13px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; color: rgb(113, 49, 168); "><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">        </span></span>vtkPoints<span style="color: #000000">* points = </span>vtkPoints<span style="color: #000000">::</span><span style="color: #400c80">New</span><span style="color: #000000">();</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">        </span>model-&gt;<span style="color: #400c80">SetPoints</span>(points);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">        </span>points-&gt;<span style="color: #400c80">Delete</span>();</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px"><span class="Apple-tab-span" style="white-space:pre">        </span><br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; color: rgb(113, 49, 168); "><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">        </span></span>vtkFieldData<span style="color: #000000">* fieldData = </span>vtkFieldData<span style="color: #000000">::</span><span style="color: #400c80">New</span><span style="color: #000000">();</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">        </span>model-&gt;<span style="color: #400c80">SetFieldData</span>(fieldData);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">        </span>fieldData-&gt;<span style="color: #400c80">Delete</span>();</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; min-height: 13.0px"><span class="Apple-tab-span" style="white-space:pre">        </span><br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; color: rgb(113, 49, 168); "><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">        </span></span>vtkCellArray<span style="color: #000000">* cells = </span>vtkCellArray<span style="color: #000000">::</span><span style="color: #400c80">New</span><span style="color: #000000">();</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">        </span>model-&gt;<span style="color: #400c80">SetVerts</span>(cells);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">        </span>cells-&gt;<span style="color: #400c80">Delete</span>();<span class="Apple-tab-span" style="white-space:pre">        </span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre"><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre"><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre"><br></span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Menlo; "><span class="Apple-tab-span" style="white-space:pre">R</span>agu</div></div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>Powered by <a href="http://www.kitware.com"><a href="http://www.kitware.com">www.kitware.com</a></a></span><br><span></span><br><span>Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html"><a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a></a></span><br><span></span><br><span>Follow this link to subscribe/unsubscribe:</span><br><span><a href="http://www.vtk.org/mailman/listinfo/vtk-developers">http://www.vtk.org/mailman/listinfo/vtk-developers</a></span><br><span></span><br></div></blockquote></body></html>