Skip to content
Permalink
Browse files

Fixed a crash when a QgsGrassModel::VectorLayer contained into a mult…

…iple selection is deleted, renamed or copied.

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11203 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rugginoso
rugginoso committed Jul 29, 2009
1 parent b2d5840 commit 35907b6fa0c672503c7f3ca2335bc5907a8215b7
Showing with 29 additions and 4 deletions.
  1. +29 −4 src/plugins/grass/qgsgrassbrowser.cpp
@@ -216,7 +216,14 @@ void QgsGrassBrowser::copyMap()
{
QgsDebugMsg( "entered." );

QModelIndexList indexes = mTree->selectionModel()->selectedIndexes();
// Filter VectorLayer type from selection
QModelIndexList indexes;
foreach(QModelIndex index, mTree->selectionModel()->selectedIndexes()){
int type = mModel->itemType(index);
if (type != QgsGrassModel::VectorLayer){
indexes << index;
}
}

QList<QModelIndex>::const_iterator it = indexes.begin();
for ( ; it != indexes.end(); ++it )
@@ -288,7 +295,14 @@ void QgsGrassBrowser::renameMap()
{
QgsDebugMsg( "entered." );

QModelIndexList indexes = mTree->selectionModel()->selectedIndexes();
// Filter VectorLayer type from selection
QModelIndexList indexes;
foreach(QModelIndex index, mTree->selectionModel()->selectedIndexes()){
int type = mModel->itemType(index);
if (type != QgsGrassModel::VectorLayer){
indexes << index;
}
}

QList<QModelIndex>::const_iterator it = indexes.begin();
for ( ; it != indexes.end(); ++it )
@@ -352,10 +366,21 @@ void QgsGrassBrowser::deleteMap()
{
QgsDebugMsg( "entered." );

QModelIndexList indexes = mTree->selectionModel()->selectedIndexes();
// Filter VectorLayer type from selection
QModelIndexList indexes;
foreach(QModelIndex index, mTree->selectionModel()->selectedIndexes()){
int type = mModel->itemType(index);
if (type != QgsGrassModel::VectorLayer){
indexes << index;
}
}

if (!QMessageBox::question(this, tr("Question"), tr("Are you sure you want to delete the %1 selected layer(s)?").arg(indexes.size())))
if (QMessageBox::question(this, tr("Question"),
tr("Are you sure you want to delete the %1 selected layer(s)?").arg(indexes.size()),
QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)
{
return;
}

QList<QModelIndex>::const_iterator it = indexes.begin();
for ( ; it != indexes.end(); ++it )

0 comments on commit 35907b6

Please sign in to comment.
You can’t perform that action at this time.