Skip to content

Commit

Permalink
Fixes #17576 Avoid crash during node editor cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
pblottiere committed Feb 16, 2018
1 parent 0310c1d commit 45ca0eb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/app/vertextool/qgsvertextool.cpp
Expand Up @@ -984,7 +984,7 @@ void QgsVertexTool::showVertexEditor() //#spellok
mVertexEditor.reset( new QgsVertexEditor( m.layer(), mSelectedFeature.get(), mCanvas ) );
QgisApp::instance()->addDockWidget( Qt::LeftDockWidgetArea, mVertexEditor.get() );
connect( mVertexEditor.get(), &QgsVertexEditor::deleteSelectedRequested, this, &QgsVertexTool::deleteVertexEditorSelection );
connect( mSelectedFeature.get()->vlayer(), &QgsVectorLayer::featureDeleted, this, [ = ]( QgsFeatureId id ) { if ( mSelectedFeature.get()->featureId() == id ) cleanupVertexEditor(); } );
connect( mSelectedFeature.get()->vlayer(), &QgsVectorLayer::featureDeleted, this, &QgsVertexTool::cleanEditor );
}

void QgsVertexTool::cleanupVertexEditor()
Expand Down Expand Up @@ -2161,3 +2161,11 @@ void QgsVertexTool::stopRangeVertexSelection()
mSelectionMethod = SelectionNormal;
setHighlightedVertices( QList<Vertex>() );
}

void QgsVertexTool::cleanEditor( QgsFeatureId id )
{
if ( mSelectedFeature.get() && mSelectedFeature.get()->featureId() == id )
{
cleanupVertexEditor();
};
}
2 changes: 2 additions & 0 deletions src/app/vertextool/qgsvertextool.h
Expand Up @@ -97,6 +97,8 @@ class APP_EXPORT QgsVertexTool : public QgsMapToolAdvancedDigitizing

void startRangeVertexSelection();

void cleanEditor( QgsFeatureId id );

private:

void buildDragBandsForVertices( const QSet<Vertex> &movingVertices, const QgsPointXY &dragVertexMapPoint );
Expand Down

0 comments on commit 45ca0eb

Please sign in to comment.