[QGIS Commit] r11145 - trunk/qgis/src/app

svn_qgis at osgeo.org svn_qgis at osgeo.org
Wed Jul 22 07:54:45 EDT 2009


Author: wonder
Date: 2009-07-22 07:54:44 -0400 (Wed, 22 Jul 2009)
New Revision: 11145

Modified:
   trunk/qgis/src/app/qgsmaptooldeletevertex.cpp
Log:
Destroy active undo command if the vertex can't be deleted


Modified: trunk/qgis/src/app/qgsmaptooldeletevertex.cpp
===================================================================
--- trunk/qgis/src/app/qgsmaptooldeletevertex.cpp	2009-07-22 11:52:18 UTC (rev 11144)
+++ trunk/qgis/src/app/qgsmaptooldeletevertex.cpp	2009-07-22 11:54:44 UTC (rev 11145)
@@ -76,15 +76,24 @@
     vlayer = dynamic_cast<QgsVectorLayer*>( currentLayer );
   }
 
+  bool success = true;
   if ( vlayer && mRecentSnappingResults.size() > 0 )
   {
     QList<QgsSnappingResult>::iterator sr_it = mRecentSnappingResults.begin();
     vlayer->beginEditCommand( tr( "Vertex deleted" ) );
     for ( ; sr_it != mRecentSnappingResults.end(); ++sr_it )
     {
-      vlayer->deleteVertex( sr_it->snappedAtGeometry, sr_it->snappedVertexNr );
+      if (!vlayer->deleteVertex( sr_it->snappedAtGeometry, sr_it->snappedVertexNr ))
+      {
+        success = false;
+        vlayer->destroyEditCommand();
+        break;
+      }
     }
-    vlayer->endEditCommand();
+    if (success)
+    {
+      vlayer->endEditCommand();
+    }
   }
 
   mCanvas->refresh();



More information about the QGIS-commit mailing list