<div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">I&#39;m confused - you don&#39;t have to allocate any pointers for the list.<br>

The QList class uses implicit sharing of data (like many other qt<br>
classes), so the list can be passed by value very cheaply. Please<br>
paste the code of the whole method if it&#39;s not too long and indicate<br>
on what line the application crashes.<br></blockquote>
<div><br>Hi Martin,<br><br>Thanks for your help. Here is the relevant code:<br><br><div style="margin-left: 40px;"><font size="2"><span style="font-family: courier new,monospace;">void MainWindow::mergeFeatures(void)</span></font><br style="font-family: courier new,monospace;">
<font size="2"><span style="font-family: courier new,monospace;">{</span></font><br style="font-family: courier new,monospace;"><font size="2"><span style="font-family: courier new,monospace;">    if ( !this-&gt;currentLayer ) {</span></font><br style="font-family: courier new,monospace;">
<font size="2"><span style="font-family: courier new,monospace;">        QMessageBox::information( 0, tr( &quot;Active layer is not vector&quot; ), tr( &quot;The merge features tool only works on vector layers. Please select a vector layer from the layer list&quot; ) );</span></font><br style="font-family: courier new,monospace;">
<font size="2"><span style="font-family: courier new,monospace;">        return;</span></font><br style="font-family: courier new,monospace;"><font size="2"><span style="font-family: courier new,monospace;">    }</span></font><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><font size="2"><span style="font-family: courier new,monospace;">    this-&gt;developmentsLayer-&gt;startEditing();</span></font><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><font size="2"><span style="font-family: courier new,monospace;">    if ( !this-&gt;developmentsLayer-&gt;isEditable() ) {</span></font><br style="font-family: courier new,monospace;">
<font size="2"><span style="font-family: courier new,monospace;">        QMessageBox::information( 0, tr( &quot;Layer not editable&quot; ), tr( &quot;Merging features can only be done for layers in editing mode. To use the merge tool, go to  Layer-&gt;Toggle editing&quot; ) );</span></font><br style="font-family: courier new,monospace;">
<font size="2"><span style="font-family: courier new,monospace;">        return;</span></font><br style="font-family: courier new,monospace;"><font size="2"><span style="font-family: courier new,monospace;">    }</span></font><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><font size="2"><span style="font-family: courier new,monospace;">    const QgsFeatureIds &amp;featureIdSet = this-&gt;currentLayer-&gt;selectedFeaturesIds();</span></font><br style="font-family: courier new,monospace;">
<font size="2"><span style="font-family: courier new,monospace;">    if ( featureIdSet.size() &lt; 2 ) {</span></font><br style="font-family: courier new,monospace;"><font size="2"><span style="font-family: courier new,monospace;">        QMessageBox::information( 0, tr( &quot;Not enough features selected&quot; ), tr( &quot;The merge tool requires at least two selected features&quot; ) );</span></font><br style="font-family: courier new,monospace;">
<font size="2"><span style="font-family: courier new,monospace;">        return;</span></font><br style="font-family: courier new,monospace;"><font size="2"><span style="font-family: courier new,monospace;">    }</span></font><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><font size="2"><span style="font-family: courier new,monospace;">    //get initial selection (may be altered by attribute merge dialog later)</span></font><br style="font-family: courier new,monospace;">
<font size="2"><span style="font-family: courier new,monospace;">    QgsFeatureList &amp;featureList = this-&gt;currentLayer-&gt;selectedFeatures();  //get QList&lt;QgsFeature&gt;</span></font><br style="font-family: courier new,monospace;">
<font size="2"><span style="font-family: courier new,monospace;">    bool canceled;</span></font><br style="font-family: courier new,monospace;"><font size="2"><span style="font-family: courier new,monospace;">    QgsGeometry* unionGeom = unionGeometries( this-&gt;currentLayer, featureList, canceled );</span></font><br style="font-family: courier new,monospace;">
<font size="2"><span style="font-family: courier new,monospace;">    if(!unionGeom) {</span></font><br style="font-family: courier new,monospace;"><font size="2"><span style="font-family: courier new,monospace;">        if (!canceled) {</span></font><br style="font-family: courier new,monospace;">
<font size="2"><span style="font-family: courier new,monospace;">            QMessageBox::critical( 0, tr( &quot;Merge failed&quot; ), tr( &quot;An error occured during the merge operation&quot; ) );</span></font><br style="font-family: courier new,monospace;">
<font size="2"><span style="font-family: courier new,monospace;">        }</span></font><br style="font-family: courier new,monospace;"><font size="2"><span style="font-family: courier new,monospace;">        return;</span></font><br style="font-family: courier new,monospace;">
<font size="2"><span style="font-family: courier new,monospace;">    }</span></font><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><font size="2"><span style="font-family: courier new,monospace;">    this-&gt;developmentsLayer-&gt;beginEditCommand( tr( &quot;Merged features&quot; ) );</span></font><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><font size="2"><span style="font-family: courier new,monospace;">  //create new feature</span></font><br style="font-family: courier new,monospace;"><font size="2"><span style="font-family: courier new,monospace;">  QgsFeature newFeature;</span></font><br style="font-family: courier new,monospace;">
<font size="2"><span style="font-family: courier new,monospace;">  newFeature.setGeometry( unionGeom );</span></font><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;"><font size="2"><span style="font-family: courier new,monospace;">  this-&gt;developmentsLayer-&gt;addFeature( newFeature, false );</span></font><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><font size="2"><span style="font-family: courier new,monospace;">  this-&gt;statusBar()-&gt;showMessage( tr(&quot;Saving new Development Project...&quot;));</span></font><br style="font-family: courier new,monospace;">
<br style="font-family: courier new,monospace;"><font size="2"><span style="font-family: courier new,monospace;">  this-&gt;developmentsLayer-&gt;endEditCommand();</span></font><br style="font-family: courier new,monospace;">
<font size="2"><span style="font-family: courier new,monospace;">  this-&gt;developmentsLayer-&gt;commitChanges();</span></font><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<font size="2"><span style="font-family: courier new,monospace;">  this-&gt;currentLayer-&gt;removeSelection();</span></font><br style="font-family: courier new,monospace;"><br style="font-family: courier new,monospace;">
<font size="2"><span style="font-family: courier new,monospace;">  this-&gt;statusBar()-&gt;showMessage( tr(&quot;Project saved.&quot;));</span></font><br style="font-family: courier new,monospace;"><font size="2"><span style="font-family: courier new,monospace;">} </span></font><br style="font-family: courier new,monospace;">
</div></div></div><br>Then, at method end, it yields:<br><br><blockquote style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;" class="gmail_quote">Debug Assertion Failed!<br><br>
File: dbgdel.cpp, Line: 52<br>Expression: _BLOCK_TYPE_IS_VALID(pHead-&gt;nBlockUse)<br></blockquote><div><br>The backtrace shows the call to ~QList() as one of the last frames.<br><br>Thanks again..! <br><br>--<br>fede<br>
</div>