> > I'm confused - you don't have to allocate any pointers for the list. > The QList class uses implicit sharing of data (like many other qt > classes), so the list can be passed by value very cheaply. Please > paste the code of the whole method if it's not too long and indicate > on what line the application crashes. >
Hi Martin, Thanks for your help. Here is the relevant code: void MainWindow::mergeFeatures(void) { if ( !this->currentLayer ) { 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" ) ); return; } this->developmentsLayer->startEditing(); if ( !this->developmentsLayer->isEditable() ) { 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" ) ); return; } const QgsFeatureIds &featureIdSet = this->currentLayer->selectedFeaturesIds(); if ( featureIdSet.size() < 2 ) { QMessageBox::information( 0, tr( "Not enough features selected" ), tr( "The merge tool requires at least two selected features" ) ); return; } //get initial selection (may be altered by attribute merge dialog later) QgsFeatureList &featureList = this->currentLayer->selectedFeatures(); //get QList<QgsFeature> bool canceled; QgsGeometry* unionGeom = unionGeometries( this->currentLayer, featureList, canceled ); if(!unionGeom) { if (!canceled) { QMessageBox::critical( 0, tr( "Merge failed" ), tr( "An error occured during the merge operation" ) ); } return; } this->developmentsLayer->beginEditCommand( tr( "Merged features" ) ); //create new feature QgsFeature newFeature; newFeature.setGeometry( unionGeom ); this->developmentsLayer->addFeature( newFeature, false ); this->statusBar()->showMessage( tr("Saving new Development Project...")); this->developmentsLayer->endEditCommand(); this->developmentsLayer->commitChanges(); this->currentLayer->removeSelection(); this->statusBar()->showMessage( tr("Project saved.")); } Then, at method end, it yields: Debug Assertion Failed! > > File: dbgdel.cpp, Line: 52 > Expression: _BLOCK_TYPE_IS_VALID(pHead->nBlockUse) > The backtrace shows the call to ~QList() as one of the last frames. Thanks again..! -- fede
_______________________________________________ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer