Skip to content

Commit

Permalink
[georef] Fix crash when closing georeferencer window while editing
Browse files Browse the repository at this point in the history
GCP list item
  • Loading branch information
nyalldawson committed Jun 18, 2015
1 parent ca78488 commit 34cbbde
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/plugins/georeferencer/qgsgcplistwidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,14 @@ void QgsGCPListWidget::updateGCPList()
adjustTableContent();
}

void QgsGCPListWidget::closeEditors()
{
Q_FOREACH( QModelIndex index, selectedIndexes() )
{
closePersistentEditor( index );
}
}

void QgsGCPListWidget::itemDoubleClicked( QModelIndex index )
{
index = static_cast<const QSortFilterProxyModel*>( model() )->mapToSource( index );
Expand Down
1 change: 1 addition & 0 deletions src/plugins/georeferencer/qgsgcplistwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class QgsGCPListWidget : public QTableView
void setGeorefTransform( QgsGeorefTransform *theGeorefTransform );
QgsGCPList *gcpList() { return mGCPList; }
void updateGCPList();
void closeEditors();

public slots:
// This slot is called by the list view if an item is double-clicked
Expand Down
4 changes: 4 additions & 0 deletions src/plugins/georeferencer/qgsgeorefplugingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2122,6 +2122,10 @@ bool QgsGeorefPluginGui::equalGCPlists( const QgsGCPList &list1, const QgsGCPLis

void QgsGeorefPluginGui::clearGCPData()
{
//force all list widget editors to close before removing data points
//otherwise the editors try to update deleted data points when they close
mGCPListWidget->closeEditors();

qDeleteAll( mPoints );
mPoints.clear();
mGCPListWidget->updateGCPList();
Expand Down

0 comments on commit 34cbbde

Please sign in to comment.