Skip to content

Commit

Permalink
Fix #11426 (Right click cause crash when digitizing polygon inner ring)
Browse files Browse the repository at this point in the history
Also fixed the same crash for add part and fill ring map tools.
  • Loading branch information
wonder-sk committed Oct 20, 2014
1 parent d11597a commit fb32178
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/app/qgsmaptooladdpart.cpp
Expand Up @@ -115,6 +115,11 @@ void QgsMapToolAddPart::canvasReleaseEvent( QMouseEvent * e )
return;
}

if ( !isCapturing() )
return;

// we are now going to finish the capturing

if ( mode() == CapturePolygon )
{
//close polygon
Expand Down
3 changes: 3 additions & 0 deletions src/app/qgsmaptooladdring.cpp
Expand Up @@ -72,6 +72,9 @@ void QgsMapToolAddRing::canvasReleaseEvent( QMouseEvent * e )
}
else if ( e->button() == Qt::RightButton )
{
if ( !isCapturing() )
return;

deleteTempRubberBand();

closePolygon();
Expand Down
5 changes: 5 additions & 0 deletions src/app/qgsmaptoolcapture.cpp
Expand Up @@ -268,6 +268,11 @@ void QgsMapToolCapture::startCapturing()
mCapturing = true;
}

bool QgsMapToolCapture::isCapturing() const
{
return mCapturing;
}

void QgsMapToolCapture::stopCapturing()
{
if ( mRubberBand )
Expand Down
1 change: 1 addition & 0 deletions src/app/qgsmaptoolcapture.h
Expand Up @@ -79,6 +79,7 @@ class APP_EXPORT QgsMapToolCapture : public QgsMapToolEdit
void undo();

void startCapturing();
bool isCapturing() const;
void stopCapturing();
void deleteTempRubberBand();

Expand Down
3 changes: 3 additions & 0 deletions src/app/qgsmaptoolfillring.cpp
Expand Up @@ -73,6 +73,9 @@ void QgsMapToolFillRing::canvasReleaseEvent( QMouseEvent * e )
}
else if ( e->button() == Qt::RightButton )
{
if ( !isCapturing() )
return;

deleteTempRubberBand();

closePolygon();
Expand Down

0 comments on commit fb32178

Please sign in to comment.