<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">It seems the crash occurs at Delete for both &quot;regular&quot; pointers and vtkSmartPointer ?!<br>
<br>
Can someone reproduce the problem ? If yes, does somebody know what and where is the problem ?!
<br>
<br>
There are 4 situations :<br>
<br>
1. pointer commented &#43; smart pointer allocated but not used : no crash<br>
~&gt;more adaptor.cpp; cmake -DParaView_DIR:string=~/Programs/Paraview/ParaView-v4.0.1-build/local/lib/cmake/paraview-4.0 -DCMAKE_BUILD_TYPE=Debug .; make clean all; ./stupid
<br>
...<br>
adaptor::adaptor ()<br>
{<br>
&nbsp; _spProcessor = vtkSmartPointer&lt;vtkCPProcessor&gt;::New();<br>
//&nbsp; if ( _spProcessor ) _spProcessor -&gt; Initialize ();<br>
//&nbsp; _pProcessor = vtkCPProcessor::New();<br>
//&nbsp; if ( _pProcessor ) _pProcessor -&gt; Initialize ();<br>
&nbsp; cout &lt;&lt; &quot;adaptor OK&quot; &lt;&lt; endl;<br>
}<br>
adaptor::~adaptor ()<br>
{<br>
//&nbsp; if ( _pProcessor ) _pProcessor -&gt; Delete ();<br>
}<br>
...<br>
[ 50%] Building CXX object CMakeFiles/stupid.dir/stupid.cpp.o<br>
[100%] Building CXX object CMakeFiles/stupid.dir/adaptor.cpp.o<br>
Linking CXX executable stupid<br>
[100%] Built target stupid<br>
adaptor OK<br>
OK<br>
<br>
2. pointer commented &#43; smart pointer allocated <b>and</b> used : <b>crash</b><br>
...<br>
adaptor::adaptor ()<br>
{<br>
&nbsp; _spProcessor = vtkSmartPointer&lt;vtkCPProcessor&gt;::New();<br>
<b>&nbsp; if ( _spProcessor ) _spProcessor -&gt; Initialize ();</b><br>
//&nbsp; _pProcessor = vtkCPProcessor::New();<br>
//&nbsp; if ( _pProcessor ) _pProcessor -&gt; Initialize ();<br>
&nbsp; cout &lt;&lt; &quot;adaptor OK&quot; &lt;&lt; endl;<br>
}<br>
adaptor::~adaptor ()<br>
{<br>
//&nbsp; if ( _pProcessor ) _pProcessor -&gt; Delete ();<br>
}<br>
...<br>
[ 50%] Building CXX object CMakeFiles/stupid.dir/stupid.cpp.o<br>
[100%] Building CXX object CMakeFiles/stupid.dir/adaptor.cpp.o<br>
Linking CXX executable stupid<br>
[100%] Built target stupid<br>
adaptor OK<br>
OK<br>
*** The MPI_Comm_free() function was called after MPI_FINALIZE was invoked.<br>
*** This is disallowed by the MPI standard.<br>
*** Your MPI job will now abort.<br>
[mdlslx07:16114] Abort after MPI_FINALIZE completed successfully; not able to guarantee that all other processes were killed!<br>
*** The MPI_Comm_free() function was called after MPI_FINALIZE was invoked.<br>
*** This is disallowed by the MPI standard.<br>
*** Your MPI job will now abort.<br>
*** The MPI_Comm_free() function was called after MPI_FINALIZE was invoked.<br>
*** This is disallowed by the MPI standard.<br>
*** Your MPI job will now abort.<br>
[mdlslx07:16114] *** Process received signal ***<br>
[mdlslx07:16114] Signal: Segmentation fault (11)<br>
[mdlslx07:16114] Signal code: Address not mapped (1)<br>
[mdlslx07:16114] Failing at address: 0x54<br>
[mdlslx07:16114] [ 0] /lib/x86_64-linux-gnu/libc.so.6(&#43;0x364a0) [0x7f4d2fc864a0]<br>
[mdlslx07:16114] [ 1] /usr/lib/libmpi.so.0(ompi_errhandler_invoke&#43;0x60) [0x7f4d30a0fd40]<br>
[mdlslx07:16114] [ 2] /usr/lib/libmpi.so.0(PMPI_Comm_free&#43;0x151) [0x7f4d30a3aaf1]<br>
[mdlslx07:16114] [ 3] /home/fhoussen/Programs/Paraview/ParaView-v4.0.1-build/local/lib/paraview-4.0/libvtkParallelMPI-pv4.0.so.1(_ZN18vtkMPICommunicatorD1Ev&#43;0x3f) [0x7f4d2d47412f]<br>
[mdlslx07:16114] [ 4] /home/fhoussen/Programs/Paraview/ParaView-v4.0.1-build/local/lib/paraview-4.0/libvtkParallelMPI-pv4.0.so.1(_ZN18vtkMPICommunicatorD0Ev&#43;0x9) [0x7f4d2d474179]<br>
[mdlslx07:16114] [ 5] /home/fhoussen/Programs/Paraview/ParaView-v4.0.1-build/local/lib/paraview-4.0/libvtkParallelMPI-pv4.0.so.1(_ZN16vtkMPIController25InitializeRMICommunicatorEv&#43;0x13) [0x7f4d2d47e9b3]<br>
[mdlslx07:16114] [ 6] /home/fhoussen/Programs/Paraview/ParaView-v4.0.1-build/local/lib/paraview-4.0/libvtkParallelMPI-pv4.0.so.1(_ZN16vtkMPIControllerD2Ev&#43;0x1d) [0x7f4d2d47eb1d]<br>
[mdlslx07:16114] [ 7] /home/fhoussen/Programs/Paraview/ParaView-v4.0.1-build/local/lib/paraview-4.0/libvtkParallelMPI-pv4.0.so.1(_ZN16vtkMPIControllerD0Ev&#43;0x9) [0x7f4d2d47eb69]<br>
[mdlslx07:16114] [ 8] /lib/x86_64-linux-gnu/libc.so.6(__cxa_finalize&#43;0x9d) [0x7f4d2fc8bd1d]<br>
[mdlslx07:16114] [ 9] /home/fhoussen/Programs/Paraview/ParaView-v4.0.1-build/local/lib/paraview-4.0/libvtkPVClientServerCoreCore-pv4.0.so.1(&#43;0x3d166) [0x7f4d2f0be166]<br>
[mdlslx07:16114] *** End of error message ***<br>
<br>
3. smart pointer commented &#43; pointer allocated and used but <b>not deleted</b> : <b>
no</b> crash<br>
~&gt;more adaptor.cpp; cmake -DParaView_DIR:string=~/Programs/Paraview/ParaView-v4.0.1-build/local/lib/cmake/paraview-4.0 -DCMAKE_BUILD_TYPE=Debug .; make clean all; ./stupid
<br>
...<br>
adaptor::adaptor ()<br>
{<br>
//&nbsp; _spProcessor = vtkSmartPointer&lt;vtkCPProcessor&gt;::New();<br>
//&nbsp; if ( _spProcessor ) _spProcessor -&gt; Initialize ();<br>
<b>&nbsp; _pProcessor = vtkCPProcessor::New();<br>
&nbsp; if ( _pProcessor ) _pProcessor -&gt; Initialize ();</b><br>
&nbsp; cout &lt;&lt; &quot;adaptor OK&quot; &lt;&lt; endl;<br>
}<br>
adaptor::~adaptor ()<br>
{<br>
//&nbsp; if ( _pProcessor ) _pProcessor -&gt; Delete ();<br>
}<br>
...<br>
[ 50%] Building CXX object CMakeFiles/stupid.dir/stupid.cpp.o<br>
[100%] Building CXX object CMakeFiles/stupid.dir/adaptor.cpp.o<br>
Linking CXX executable stupid<br>
[100%] Built target stupid<br>
adaptor OK<br>
OK<br>
<br>
3. smart pointer commented &#43; pointer allocated and used <b>and deleted</b> : <b>crash</b><br>
~&gt;more adaptor.cpp; cmake -DParaView_DIR:string=~/Programs/Paraview/ParaView-v4.0.1-build/local/lib/cmake/paraview-4.0 -DCMAKE_BUILD_TYPE=Debug .; make clean all; ./stupid
<br>
...<br>
adaptor::adaptor ()<br>
{<br>
//&nbsp; _spProcessor = vtkSmartPointer&lt;vtkCPProcessor&gt;::New();<br>
//&nbsp; if ( _spProcessor ) _spProcessor -&gt; Initialize ();<br>
&nbsp; _pProcessor = vtkCPProcessor::New();<br>
&nbsp; if ( _pProcessor ) _pProcessor -&gt; Initialize ();<br>
&nbsp; cout &lt;&lt; &quot;adaptor OK&quot; &lt;&lt; endl;<br>
}<br>
adaptor::~adaptor ()<br>
{<br>
<b>&nbsp; if ( _pProcessor ) _pProcessor -&gt; Delete ();</b><br>
}<br>
...<br>
[ 50%] Building CXX object CMakeFiles/stupid.dir/stupid.cpp.o<br>
[100%] Building CXX object CMakeFiles/stupid.dir/adaptor.cpp.o<br>
Linking CXX executable stupid<br>
[100%] Built target stupid<br>
adaptor OK<br>
OK<br>
*** The MPI_Comm_free() function was called after MPI_FINALIZE was invoked.<br>
*** This is disallowed by the MPI standard.<br>
*** Your MPI job will now abort.<br>
[mdlslx07:16411] Abort after MPI_FINALIZE completed successfully; not able to guarantee that all other processes were killed!<br>
*** The MPI_Comm_free() function was called after MPI_FINALIZE was invoked.<br>
*** This is disallowed by the MPI standard.<br>
*** Your MPI job will now abort.<br>
*** The MPI_Comm_free() function was called after MPI_FINALIZE was invoked.<br>
*** This is disallowed by the MPI standard.<br>
*** Your MPI job will now abort.<br>
[mdlslx07:16411] *** Process received signal ***<br>
[mdlslx07:16411] Signal: Segmentation fault (11)<br>
[mdlslx07:16411] Signal code: Address not mapped (1)<br>
[mdlslx07:16411] Failing at address: 0x54<br>
[mdlslx07:16411] [ 0] /lib/x86_64-linux-gnu/libc.so.6(&#43;0x364a0) [0x7f462a7e24a0]<br>
[mdlslx07:16411] [ 1] /usr/lib/libmpi.so.0(ompi_errhandler_invoke&#43;0x60) [0x7f462b56bd40]<br>
[mdlslx07:16411] [ 2] /usr/lib/libmpi.so.0(PMPI_Comm_free&#43;0x151) [0x7f462b596af1]<br>
[mdlslx07:16411] [ 3] /home/fhoussen/Programs/Paraview/ParaView-v4.0.1-build/local/lib/paraview-4.0/libvtkParallelMPI-pv4.0.so.1(_ZN18vtkMPICommunicatorD1Ev&#43;0x3f) [0x7f4627fd012f]<br>
[mdlslx07:16411] [ 4] /home/fhoussen/Programs/Paraview/ParaView-v4.0.1-build/local/lib/paraview-4.0/libvtkParallelMPI-pv4.0.so.1(_ZN18vtkMPICommunicatorD0Ev&#43;0x9) [0x7f4627fd0179]<br>
[mdlslx07:16411] [ 5] /home/fhoussen/Programs/Paraview/ParaView-v4.0.1-build/local/lib/paraview-4.0/libvtkParallelMPI-pv4.0.so.1(_ZN16vtkMPIController25InitializeRMICommunicatorEv&#43;0x13) [0x7f4627fda9b3]<br>
[mdlslx07:16411] [ 6] /home/fhoussen/Programs/Paraview/ParaView-v4.0.1-build/local/lib/paraview-4.0/libvtkParallelMPI-pv4.0.so.1(_ZN16vtkMPIControllerD2Ev&#43;0x1d) [0x7f4627fdab1d]<br>
[mdlslx07:16411] [ 7] /home/fhoussen/Programs/Paraview/ParaView-v4.0.1-build/local/lib/paraview-4.0/libvtkParallelMPI-pv4.0.so.1(_ZN16vtkMPIControllerD0Ev&#43;0x9) [0x7f4627fdab69]<br>
[mdlslx07:16411] [ 8] /lib/x86_64-linux-gnu/libc.so.6(__cxa_finalize&#43;0x9d) [0x7f462a7e7d1d]<br>
[mdlslx07:16411] [ 9] /home/fhoussen/Programs/Paraview/ParaView-v4.0.1-build/local/lib/paraview-4.0/libvtkPVClientServerCoreCore-pv4.0.so.1(&#43;0x3d166) [0x7f4629c1a166]<br>
[mdlslx07:16411] *** End of error message ***<br>
<br>
I don't understand why this is crashing !?...<br>
<br>
FH<br>
<br>
<div style="font-family: Times New Roman; color: #000000; font-size: 16px">
<hr tabindex="-1">
<div style="direction: ltr;" id="divRpF506028"><font color="#000000" face="Tahoma" size="2"><b>De :</b> Andy Bauer [andy.bauer@kitware.com]<br>
<b>Date d'envoi :</b> dimanche 4 août 2013 21:59<br>
<b>À&nbsp;:</b> HOUSSEN Franck<br>
<b>Cc:</b> paraview@paraview.org<br>
<b>Objet :</b> Re: [Paraview] Catalyst : crash using vtkSmartPointers<br>
</font><br>
</div>
<div></div>
<div>Hi,<br>
<br>
I didn't have any problems using a vtkSmartPointer for vtkCPProcessor. I'd have to see your full code to know for sure but my guess is that _spProcessor is a pointer to a vtkCPProcessor and not a vtkSmartPointer&lt;vtkCPProcessor&gt;. When I make that mistake I get
 a crash.<br>
<br>
Regards,<br>
Andy<br>
<br>
<div class="gmail_quote">On Sat, Aug 3, 2013 at 4:41 AM, HOUSSEN Franck <span dir="ltr">
&lt;<a href="mailto:Franck.Houssen@cea.fr" target="_blank">Franck.Houssen@cea.fr</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div>
<div style="direction:ltr; font-size:10pt; font-family:Tahoma">Hello,<br>
<br>
I try to understand if (and how) I can use Catalyst for my need (in-situ visualisation). I started with :
<a href="http://paraview.org/Wiki/ParaView/Catalyst/Overview" target="_blank">http://paraview.org/Wiki/ParaView/Catalyst/Overview</a><br>
<br>
To code the adaptor, you need to handle VTK objects. When using VTK, I generally prefer to use smart pointers (avoid looking for leaks).<br>
Here is my code (this is the only call / use of VTK object in the all code)<br>
paraviewAdaptor::paraviewAdaptor ()<br>
{<br>
&nbsp; _spProcessor = vtkSmartPointer&lt;vtkCPProcessor&gt;::New ();<br>
//&nbsp; _spProcessor -&gt; Initialize (); // Crash if uncommented ?!<br>
}<br>
Compilation is OK, but at run time I get a crash with this error message :<br>
*** The MPI_Comm_free() function was called after MPI_FINALIZE was invoked.<br>
*** This is disallowed by the MPI standard.<br>
<br>
So I tried to use pointers instead of smartpointers :<br>
paraviewAdaptor::paraviewAdaptor ()<br>
{<br>
&nbsp; _pProcessor = vtkCPProcessor::New ();<br>
&nbsp; _pProcessor -&gt; Initialize (); // Don't crash ?!<br>
}<br>
And I don't get any crash anymore ?!....<br>
<br>
Why is that ? How can I use vtkSmartPointers ?<br>
<br>
Note : I use ParaView-v4.0.1-source.tgz and I run on Ubuntu 12.04<br>
<br>
Thanks,<br>
<br>
FH<br>
</div>
</div>
<br>
_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">
http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" target="_blank">
http://paraview.org/Wiki/ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
<br>
</blockquote>
</div>
<br>
</div>
</div>
</div>
</body>
</html>