<div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small">Posting the solution in case anyone else encounters this ...</div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small">It's a problem concerning Mac+Qt+ITK setups, as solved by Christian Lackas here:</div><div class="gmail_default" style><font face="tahoma, sans-serif"><a href="http://itk-insight-users.2283740.n2.nabble.com/ITK-crash-on-Lion-Qt-td6894083.html">http://itk-insight-users.2283740.n2.nabble.com/ITK-crash-on-Lion-Qt-td6894083.html</a></font><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On 9 December 2014 at 03:36, Senan Doyle <span dir="ltr"><<a href="mailto:senan.doyle@gmail.com" target="_blank">senan.doyle@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small">H<span style="background-color:rgb(255,255,255)"><font color="#000000">i,</font></span></div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small"><span style="background-color:rgb(255,255,255)"><font color="#000000">I'm having trouble with the <span style="font-family:arial,sans-serif">ImageMaskSpatialObject class</span></font></span></div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small"><span style="font-family:arial,sans-serif;background-color:rgb(255,255,255)"><font color="#000000">The simple code below produces</font></span></div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small"><span style="color:rgb(128,0,128);font-family:arial,sans-serif"><br></span></div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small">
<p style="margin:0px"><span style="font-family:Monaco;font-size:12pt;color:rgb(0,0,0)">malloc: *** error for object 0x109043840: pointer being freed was not allocated</span></p>
<p style="margin:0px"><span style="font-family:Monaco;font-size:12pt;color:rgb(0,0,0)">*** set a breakpoint in malloc_error_break to debug</span></p></div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small"><br></div><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small">A quick debugging shows the call to </div>
<p style="margin:0px"><span style="color:rgb(192,192,192)">  </span><span style="color:rgb(128,0,0)">m_Property</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">PropertyType</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(0,0,0)">New</span><span style="color:rgb(0,0,0)">();</span><br></p><div class="gmail_default" style="font-family:tahoma,sans-serif;font-size:small">
<p style="margin:0px">in itkSpatialObject results in the smartpointer destructor for spatialobject property being called</p><p style="margin:0px"><br></p><p style="margin:0px">Anyone seen this before?Any ideas?</p><p style="margin:0px"><br></p><p style="margin:0px"><br></p><p style="margin:0px"><br></p>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(128,128,0)">int</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">main</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">int</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">argc</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">char</span><span style="color:rgb(0,0,0)">*</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">argv</span><span style="color:rgb(0,0,0)">[]</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">)</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(0,0,0)">{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,128,0)">for</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(128,128,0)">int</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">i</span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(0,0,128)">0</span><span style="color:rgb(0,0,0)">;</span><span style="color:rgb(0,0,0)">i</span><span style="color:rgb(0,0,0)"><</span><span style="color:rgb(0,0,128)">100</span><span style="color:rgb(0,0,0)">;</span><span style="color:rgb(0,0,0)">i</span><span style="color:rgb(0,0,0)">++){</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,128,0)">typedef</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">itk</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(128,0,128)">ImageMaskSpatialObject</span><span style="color:rgb(0,0,0)"><</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">3</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">></span><span style="color:rgb(192,192,192)">   </span><span style="color:rgb(128,0,128)">MaskSpatialObjectType</span><span style="color:rgb(0,0,0)">;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,0,128)">MaskSpatialObjectType</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(128,0,128)">Pointer</span><span style="color:rgb(192,192,192)">  </span><span style="color:rgb(0,0,0)">spatialObjectMask</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">MaskSpatialObjectType</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(0,0,0)">New</span><span style="color:rgb(0,0,0)">();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,128,0)">typedef</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">itk</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(128,0,128)">Image</span><span style="color:rgb(0,0,0)"><</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">unsigned</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,128,0)">char</span><span style="color:rgb(0,0,0)">,</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">3</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">></span><span style="color:rgb(192,192,192)">   </span><span style="color:rgb(128,0,128)">ImageMaskType</span><span style="color:rgb(0,0,0)">;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,128,0)">typedef</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">itk</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(128,0,128)">ImageFileReader</span><span style="color:rgb(0,0,0)"><</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">ImageMaskType</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">></span><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(128,0,128)">MaskReaderType</span><span style="color:rgb(0,0,0)">;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,0,128)">MaskReaderType</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(128,0,128)">Pointer</span><span style="color:rgb(192,192,192)">  </span><span style="color:rgb(0,0,0)">maskReader</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">=</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">MaskReaderType</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(0,0,0)">New</span><span style="color:rgb(0,0,0)">();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(0,0,0)">maskReader</span><span style="color:rgb(0,0,0)">-></span><span style="font-style:italic;color:rgb(0,0,0)">SetFileName</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"/some/path/to/mask.nii"</span><span style="color:rgb(0,0,0)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,128,0)">try</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(0,0,0)">{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(0,0,0)">maskReader</span><span style="color:rgb(0,0,0)">-></span><span style="font-style:italic;color:rgb(0,0,0)">Update</span><span style="color:rgb(0,0,0)">();</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(0,0,0)">}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(128,128,0)">catch</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">itk</span><span style="color:rgb(0,0,0)">::</span><span style="color:rgb(128,0,128)">ExceptionObject</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">&</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">err</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">)</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(0,0,0)">{</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(128,0,128)">std</span><span style="color:rgb(0,0,0)">::</span>cerr<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)"><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">"ExceptionObject</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">caught</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,128,0)">!"</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)"><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">std</span><span style="color:rgb(0,0,0)">::</span>endl<span style="color:rgb(0,0,0)">;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(128,0,128)">std</span><span style="color:rgb(0,0,0)">::</span>cerr<span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)"><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">err</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)"><<</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(128,0,128)">std</span><span style="color:rgb(0,0,0)">::</span>endl<span style="color:rgb(0,0,0)">;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">            </span><span style="color:rgb(128,128,0)">return</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,128)">0</span><span style="color:rgb(0,0,0)">;</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(0,0,0)">}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">        </span><span style="color:rgb(0,0,0)">spatialObjectMask</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">SetImage</span><span style="color:rgb(0,0,0)">(</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">maskReader</span><span style="color:rgb(0,0,0)">-></span><span style="color:rgb(0,0,0)">GetOutput</span><span style="color:rgb(0,0,0)">()</span><span style="color:rgb(192,192,192)"> </span><span style="color:rgb(0,0,0)">);</span></pre>
<pre style="margin-top:0px;margin-bottom:0px"><br></pre>
<pre style="margin-top:0px;margin-bottom:0px"><span style="color:rgb(192,192,192)">    </span><span style="color:rgb(0,0,0)">}</span></pre>
<pre style="margin-top:0px;margin-bottom:0px">}</pre></div></div>
</blockquote></div><br></div>