<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class="">Hi all,<div class=""><br class=""></div><div class="">We have slightly modified the following wiki example:</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space:pre"> </span><a href="http://www.itk.org/Wiki/VTK/Examples/Cxx/IO/VRML" class="">http://www.itk.org/Wiki/VTK/Examples/Cxx/IO/VRML</a></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">As follows:</div><div class=""><br class=""></div><div class=""><span class="Apple-tab-span" style="white-space: pre;"> </span></div><div class=""><div dir="ltr" class="mw-code mw-geshi mw-content-ltr" style="direction: ltr; font-family: monospace, Courier; padding: 1em; border: 1px solid rgb(221, 221, 221); line-height: 1.1em; font-size: 12.6999998092651px; widows: 1; background-color: rgb(249, 249, 249);"><div class="cpp source-cpp" style="line-height: normal; font-family: monospace;"><pre class="de1" style="font-size: 1em; font-family: monospace, monospace; padding: 0px; border: 0px none white; line-height: 1.2em; margin-top: 0px; margin-bottom: 0px; vertical-align: top; background-image: none;"><span style="color: rgb(51, 153, 0); font-size: 1em; line-height: 1.2em;" class="">#include <vtkRenderer.h></span></pre><pre class="de1" style="font-size: 1em; font-family: monospace, monospace; padding: 0px; border: 0px none white; line-height: 1.2em; margin-top: 0px; margin-bottom: 0px; vertical-align: top; background-image: none;"><span class="co2" style="color: rgb(51, 153, 0);">#include <vtkRenderWindow.h></span>
<span class="co2" style="color: rgb(51, 153, 0);">#include <vtkRenderWindowInteractor.h></span>
<span class="co2" style="color: rgb(51, 153, 0);">#include <vtkVRMLImporter.h></span>
<span class="co2" style="color: rgb(51, 153, 0);">#include <vtkDataSet.h></span>
<span class="co2" style="color: rgb(51, 153, 0);">#include <vtkPolyData.h></span>
<span class="co2" style="color: rgb(51, 153, 0);">#include <vtkSmartPointer.h></span>
<span class="kw4" style="color: rgb(0, 0, 255);">int</span> main <span class="br0" style="color: rgb(0, 128, 0);">(</span> <span class="kw4" style="color: rgb(0, 0, 255);">int</span> argc, <span class="kw4" style="color: rgb(0, 0, 255);">char</span> <span class="sy2" style="color: rgb(0, 0, 64);">*</span>argv<span class="br0" style="color: rgb(0, 128, 0);">[</span><span class="br0" style="color: rgb(0, 128, 0);">]</span><span class="br0" style="color: rgb(0, 128, 0);">)</span>
<span class="br0" style="color: rgb(0, 128, 0);">{</span>
<span class="kw1" style="color: rgb(0, 0, 255);">if</span><span class="br0" style="color: rgb(0, 128, 0);">(</span>argc <span class="sy3" style="color: rgb(0, 0, 64);">!</span><span class="sy1" style="color: rgb(0, 0, 128);">=</span> <span class="nu0" style="color: rgb(0, 0, 221);">2</span><span class="br0" style="color: rgb(0, 128, 0);">)</span>
<span class="br0" style="color: rgb(0, 128, 0);">{</span>
std<span class="sy4" style="color: rgb(0, 128, 128);">::</span><span class="kw3" style="color: rgb(0, 0, 221);">cout</span> <span class="sy1" style="color: rgb(0, 0, 128);"><<</span> <span class="st0" style="color: rgb(255, 0, 0);">"Required arguments: Filename"</span> <span class="sy1" style="color: rgb(0, 0, 128);"><<</span> std<span class="sy4" style="color: rgb(0, 128, 128);">::</span><span class="me2" style="color: rgb(0, 119, 136);">endl</span><span class="sy4" style="color: rgb(0, 128, 128);">;</span>
<span class="kw1" style="color: rgb(0, 0, 255);">return</span> <span class="kw2" style="color: rgb(0, 0, 255);">EXIT_FAILURE</span><span class="sy4" style="color: rgb(0, 128, 128);">;</span>
<span class="br0" style="color: rgb(0, 128, 0);">}</span>
std<span class="sy4" style="color: rgb(0, 128, 128);">::</span><span class="me2" style="color: rgb(0, 119, 136);">string</span> filename <span class="sy1" style="color: rgb(0, 0, 128);">=</span> argv<span class="br0" style="color: rgb(0, 128, 0);">[</span><span class="nu0" style="color: rgb(0, 0, 221);">1</span><span class="br0" style="color: rgb(0, 128, 0);">]</span><span class="sy4" style="color: rgb(0, 128, 128);">;</span>
std<span class="sy4" style="color: rgb(0, 128, 128);">::</span><span class="kw3" style="color: rgb(0, 0, 221);">cout</span> <span class="sy1" style="color: rgb(0, 0, 128);"><<</span> <span class="st0" style="color: rgb(255, 0, 0);">"Reading "</span> <span class="sy1" style="color: rgb(0, 0, 128);"><<</span> filename <span class="sy1" style="color: rgb(0, 0, 128);"><<</span> std<span class="sy4" style="color: rgb(0, 128, 128);">::</span><span class="me2" style="color: rgb(0, 119, 136);">endl</span><span class="sy4" style="color: rgb(0, 128, 128);">;</span>
vtkSmartPointer<span class="sy1" style="color: rgb(0, 0, 128);"><</span>vtkRenderer<span class="sy1" style="color: rgb(0, 0, 128);">></span> renderer <span class="sy1" style="color: rgb(0, 0, 128);">=</span> vtkSmartPointer<span class="sy1" style="color: rgb(0, 0, 128);"><</span>vtkRenderer<span class="sy1" style="color: rgb(0, 0, 128);">></span><span class="sy4" style="color: rgb(0, 128, 128);">::</span><span class="me2" style="color: rgb(0, 119, 136);">New</span><span class="br0" style="color: rgb(0, 128, 0);">(</span><span class="br0" style="color: rgb(0, 128, 0);">)</span><span class="sy4" style="color: rgb(0, 128, 128);">;</span>
vtkSmartPointer<span class="sy1" style="color: rgb(0, 0, 128);"><</span>vtkRenderWindow<span class="sy1" style="color: rgb(0, 0, 128);">></span> renderWindow <span class="sy1" style="color: rgb(0, 0, 128);">=</span> vtkSmartPointer<span class="sy1" style="color: rgb(0, 0, 128);"><</span>vtkRenderWindow<span class="sy1" style="color: rgb(0, 0, 128);">></span><span class="sy4" style="color: rgb(0, 128, 128);">::</span><span class="me2" style="color: rgb(0, 119, 136);">New</span><span class="br0" style="color: rgb(0, 128, 0);">(</span><span class="br0" style="color: rgb(0, 128, 0);">)</span><span class="sy4" style="color: rgb(0, 128, 128);">;</span>
renderWindow<span class="sy2" style="color: rgb(0, 0, 64);">-</span><span class="sy1" style="color: rgb(0, 0, 128);">></span>AddRenderer<span class="br0" style="color: rgb(0, 128, 0);">(</span>renderer<span class="br0" style="color: rgb(0, 128, 0);">)</span><span class="sy4" style="color: rgb(0, 128, 128);">;</span>
vtkSmartPointer<span class="sy1" style="color: rgb(0, 0, 128);"><</span>vtkRenderWindowInteractor<span class="sy1" style="color: rgb(0, 0, 128);">></span> renderWindowInteractor <span class="sy1" style="color: rgb(0, 0, 128);">=</span> vtkSmartPointer<span class="sy1" style="color: rgb(0, 0, 128);"><</span>vtkRenderWindowInteractor<span class="sy1" style="color: rgb(0, 0, 128);">></span><span class="sy4" style="color: rgb(0, 128, 128);">::</span><span class="me2" style="color: rgb(0, 119, 136);">New</span><span class="br0" style="color: rgb(0, 128, 0);">(</span><span class="br0" style="color: rgb(0, 128, 0);">)</span><span class="sy4" style="color: rgb(0, 128, 128);">;</span>
renderWindowInteractor<span class="sy2" style="color: rgb(0, 0, 64);">-</span><span class="sy1" style="color: rgb(0, 0, 128);">></span>SetRenderWindow<span class="br0" style="color: rgb(0, 128, 0);">(</span>renderWindow<span class="br0" style="color: rgb(0, 128, 0);">)</span><span class="sy4" style="color: rgb(0, 128, 128);">;</span>
<span class="co1" style="color: rgb(102, 102, 102);">// VRML Import</span>
vtkSmartPointer<span class="sy1" style="color: rgb(0, 0, 128);"><</span>vtkVRMLImporter<span class="sy1" style="color: rgb(0, 0, 128);">></span> importer <span class="sy1" style="color: rgb(0, 0, 128);">=</span> vtkSmartPointer<span class="sy1" style="color: rgb(0, 0, 128);"><</span>vtkVRMLImporter<span class="sy1" style="color: rgb(0, 0, 128);">></span><span class="sy4" style="color: rgb(0, 128, 128);">::</span><span class="me2" style="color: rgb(0, 119, 136);">New</span><span class="br0" style="color: rgb(0, 128, 0);">(</span><span class="br0" style="color: rgb(0, 128, 0);">)</span><span class="sy4" style="color: rgb(0, 128, 128);">;</span>
importer<span class="sy2" style="color: rgb(0, 0, 64);">-</span><span class="sy1" style="color: rgb(0, 0, 128);">></span>SetFileName <span class="br0" style="color: rgb(0, 128, 0);">(</span> filename.<span class="me1" style="color: rgb(0, 119, 136);">c_str</span><span class="br0" style="color: rgb(0, 128, 0);">(</span><span class="br0" style="color: rgb(0, 128, 0);">)</span> <span class="br0" style="color: rgb(0, 128, 0);">)</span><span class="sy4" style="color: rgb(0, 128, 128);">;</span>
importer<span class="sy2" style="color: rgb(0, 0, 64);">-</span><span class="sy1" style="color: rgb(0, 0, 128);">></span>SetRenderWindow<span class="br0" style="color: rgb(0, 128, 0);">(</span>renderWindow<span class="br0" style="color: rgb(0, 128, 0);">)</span><span class="sy4" style="color: rgb(0, 128, 128);">;</span>
importer<span class="sy2" style="color: rgb(0, 0, 64);">-</span><span class="sy1" style="color: rgb(0, 0, 128);">></span>Update<span class="br0" style="color: rgb(0, 128, 0);">(</span><span class="br0" style="color: rgb(0, 128, 0);">)</span><span class="sy4" style="color: rgb(0, 128, 128);">;</span>
renderWindow<span class="sy2" style="color: rgb(0, 0, 64);">-</span><span class="sy1" style="color: rgb(0, 0, 128);">></span>Render<span class="br0" style="color: rgb(0, 128, 0);">(</span><span class="br0" style="color: rgb(0, 128, 0);">)</span><span class="sy4" style="color: rgb(0, 128, 128);">;</span>
renderWindowInteractor<span class="sy2" style="color: rgb(0, 0, 64);">-</span><span class="sy1" style="color: rgb(0, 0, 128);">></span>Start<span class="br0" style="color: rgb(0, 128, 0);">(</span><span class="br0" style="color: rgb(0, 128, 0);">)</span><span class="sy4" style="color: rgb(0, 128, 128);">;</span></pre><pre class="de1" style="font-size: 1em; font-family: monospace, monospace; padding: 0px; border: 0px none white; line-height: 1.2em; margin-top: 0px; margin-bottom: 0px; vertical-align: top; background-image: none;"><br class=""></pre><pre class="de1" style="font-size: 1em; font-family: monospace, monospace; padding: 0px; border: 0px none white; line-height: 1.2em; margin-top: 0px; margin-bottom: 0px; vertical-align: top; background-image: none;"> <span style="font-size: 1em; line-height: 1.2em;" class="">vtkSmartPointer</span><span class="sy1" style="font-size: 1em; line-height: 1.2em; color: rgb(0, 0, 128);"><</span><span style="font-size: 1em; line-height: 1.2em;" class="">vtkRenderer</span><span class="sy1" style="font-size: 1em; line-height: 1.2em; color: rgb(0, 0, 128);">></span><span style="font-size: 1em; line-height: 1.2em;" class=""> renderer2 </span><span class="sy1" style="font-size: 1em; line-height: 1.2em; color: rgb(0, 0, 128);">=</span><span style="font-size: 1em; line-height: 1.2em;" class=""> vtkSmartPointer</span><span class="sy1" style="font-size: 1em; line-height: 1.2em; color: rgb(0, 0, 128);"><</span><span style="font-size: 1em; line-height: 1.2em;" class="">vtkRenderer</span><span class="sy1" style="font-size: 1em; line-height: 1.2em; color: rgb(0, 0, 128);">></span><span class="sy4" style="font-size: 1em; line-height: 1.2em; color: rgb(0, 128, 128);">::</span><span class="me2" style="font-size: 1em; line-height: 1.2em; color: rgb(0, 119, 136);">New</span><span class="br0" style="font-size: 1em; line-height: 1.2em; color: rgb(0, 128, 0);">(</span><span class="br0" style="font-size: 1em; line-height: 1.2em; color: rgb(0, 128, 0);">)</span><span class="sy4" style="font-size: 1em; line-height: 1.2em; color: rgb(0, 128, 128);">;</span><pre class="de1" style="font-size: 1em; font-family: monospace, monospace; padding: 0px; border: 0px none white; line-height: 1.2em; margin-top: 0px; margin-bottom: 0px; vertical-align: top; background-image: none;"> vtkSmartPointer<span class="sy1" style="color: rgb(0, 0, 128);"><</span>vtkRenderWindow<span class="sy1" style="color: rgb(0, 0, 128);">></span> renderWindow2 <span class="sy1" style="color: rgb(0, 0, 128);">=</span> vtkSmartPointer<span class="sy1" style="color: rgb(0, 0, 128);"><</span>vtkRenderWindow<span class="sy1" style="color: rgb(0, 0, 128);">></span><span class="sy4" style="color: rgb(0, 128, 128);">::</span><span class="me2" style="color: rgb(0, 119, 136);">New</span><span class="br0" style="color: rgb(0, 128, 0);">(</span><span class="br0" style="color: rgb(0, 128, 0);">)</span><span class="sy4" style="color: rgb(0, 128, 128);">;</span>
renderWindow2<span class="sy2" style="color: rgb(0, 0, 64);">-</span><span class="sy1" style="color: rgb(0, 0, 128);">></span>AddRenderer<span class="br0" style="color: rgb(0, 128, 0);">(</span>renderer2<span class="br0" style="color: rgb(0, 128, 0);">)</span><span class="sy4" style="color: rgb(0, 128, 128);">;</span>
vtkSmartPointer<span class="sy1" style="color: rgb(0, 0, 128);"><</span>vtkRenderWindowInteractor<span class="sy1" style="color: rgb(0, 0, 128);">></span> renderWindowInteractor2 <span class="sy1" style="color: rgb(0, 0, 128);">=</span> vtkSmartPointer<span class="sy1" style="color: rgb(0, 0, 128);"><</span>vtkRenderWindowInteractor<span class="sy1" style="color: rgb(0, 0, 128);">></span><span class="sy4" style="color: rgb(0, 128, 128);">::</span><span class="me2" style="color: rgb(0, 119, 136);">New</span><span class="br0" style="color: rgb(0, 128, 0);">(</span><span class="br0" style="color: rgb(0, 128, 0);">)</span><span class="sy4" style="color: rgb(0, 128, 128);">;</span>
renderWindowInteractor2<span class="sy2" style="color: rgb(0, 0, 64);">-</span><span class="sy1" style="color: rgb(0, 0, 128);">></span>SetRenderWindow<span class="br0" style="color: rgb(0, 128, 0);">(</span>renderWindow2<span class="br0" style="color: rgb(0, 128, 0);">)</span><span class="sy4" style="color: rgb(0, 128, 128);">;</span>
<span class="co1" style="color: rgb(102, 102, 102);">// VRML Import</span>
vtkSmartPointer<span class="sy1" style="color: rgb(0, 0, 128);"><</span>vtkVRMLImporter<span class="sy1" style="color: rgb(0, 0, 128);">></span> importer2 <span class="sy1" style="color: rgb(0, 0, 128);">=</span> vtkSmartPointer<span class="sy1" style="color: rgb(0, 0, 128);"><</span>vtkVRMLImporter<span class="sy1" style="color: rgb(0, 0, 128);">></span><span class="sy4" style="color: rgb(0, 128, 128);">::</span><span class="me2" style="color: rgb(0, 119, 136);">New</span><span class="br0" style="color: rgb(0, 128, 0);">(</span><span class="br0" style="color: rgb(0, 128, 0);">)</span><span class="sy4" style="color: rgb(0, 128, 128);">;</span>
importer2<span class="sy2" style="color: rgb(0, 0, 64);">-</span><span class="sy1" style="color: rgb(0, 0, 128);">></span>SetFileName <span class="br0" style="color: rgb(0, 128, 0);">(</span> filename.<span class="me1" style="color: rgb(0, 119, 136);">c_str</span><span class="br0" style="color: rgb(0, 128, 0);">(</span><span class="br0" style="color: rgb(0, 128, 0);">)</span> <span class="br0" style="color: rgb(0, 128, 0);">)</span><span class="sy4" style="color: rgb(0, 128, 128);">;</span>
importer2<span class="sy2" style="color: rgb(0, 0, 64);">-</span><span class="sy1" style="color: rgb(0, 0, 128);">></span>SetRenderWindow<span class="br0" style="color: rgb(0, 128, 0);">(</span>renderWindow2<span class="br0" style="color: rgb(0, 128, 0);">)</span><span class="sy4" style="color: rgb(0, 128, 128);">;</span>
importer2<span class="sy2" style="color: rgb(0, 0, 64);">-</span><span class="sy1" style="color: rgb(0, 0, 128);">></span>Update<span class="br0" style="color: rgb(0, 128, 0);">(</span><span class="br0" style="color: rgb(0, 128, 0);">)</span><span class="sy4" style="color: rgb(0, 128, 128);">;</span>
renderWindow2<span class="sy2" style="color: rgb(0, 0, 64);">-</span><span class="sy1" style="color: rgb(0, 0, 128);">></span>Render<span class="br0" style="color: rgb(0, 128, 0);">(</span><span class="br0" style="color: rgb(0, 128, 0);">)</span><span class="sy4" style="color: rgb(0, 128, 128);">;</span>
renderWindowInteractor2<span class="sy2" style="color: rgb(0, 0, 64);">-</span><span class="sy1" style="color: rgb(0, 0, 128);">></span>Start<span class="br0" style="color: rgb(0, 128, 0);">(</span><span class="br0" style="color: rgb(0, 128, 0);">)</span><span class="sy4" style="color: rgb(0, 128, 128);">;</span></pre><div class=""><br class=""></div>
<span class="kw1" style="color: rgb(0, 0, 255);">return</span> <span class="kw2" style="color: rgb(0, 0, 255);">EXIT_SUCCESS</span><span class="sy4" style="color: rgb(0, 128, 128);">;</span>
<span class="br0" style="color: rgb(0, 128, 0);">}</span></pre><div class=""><span class="br0" style="color: rgb(0, 128, 0);"><br class=""></span></div><div class=""><span class="br0" style="color: rgb(0, 128, 0);"><br class=""></span></div></div></div></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">As you can see the modification is quite simple, we have just created 2 instances of every objects…</div><div class=""><br class=""></div><div class="">This naive example crashes when exiting (trying to delete the second importer, i.e. importer2).</div><div class=""><br class=""></div><div class="">Any idea what could go wrong? and how to fix this bug?</div><div class=""><br class=""></div><div class="">Thanks in advance,</div><div class="">Best regards</div><div class=""><br class=""></div><div class="">Arnaud</div></body></html>