<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'm confused - you don'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'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->currentLayer ) {</span></font><br style="font-family: courier new,monospace;">
<font size="2"><span style="font-family: courier new,monospace;"> QMessageBox::information( 0, tr( "Active layer is not vector" ), tr( "The merge features tool only works on vector layers. Please select a vector layer from the layer list" ) );</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->developmentsLayer->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->developmentsLayer->isEditable() ) {</span></font><br style="font-family: courier new,monospace;">
<font size="2"><span style="font-family: courier new,monospace;"> QMessageBox::information( 0, tr( "Layer not editable" ), tr( "Merging features can only be done for layers in editing mode. To use the merge tool, go to Layer->Toggle editing" ) );</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 &featureIdSet = this->currentLayer->selectedFeaturesIds();</span></font><br style="font-family: courier new,monospace;">
<font size="2"><span style="font-family: courier new,monospace;"> if ( featureIdSet.size() < 2 ) {</span></font><br style="font-family: courier new,monospace;"><font size="2"><span style="font-family: courier new,monospace;"> QMessageBox::information( 0, tr( "Not enough features selected" ), tr( "The merge tool requires at least two selected features" ) );</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 &featureList = this->currentLayer->selectedFeatures(); //get QList<QgsFeature></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->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( "Merge failed" ), tr( "An error occured during the merge operation" ) );</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->developmentsLayer->beginEditCommand( tr( "Merged features" ) );</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->developmentsLayer->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->statusBar()->showMessage( tr("Saving new Development Project..."));</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->developmentsLayer->endEditCommand();</span></font><br style="font-family: courier new,monospace;">
<font size="2"><span style="font-family: courier new,monospace;"> this->developmentsLayer->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->currentLayer->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->statusBar()->showMessage( tr("Project saved."));</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->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>