mirror of
https://github.com/qgis/QGIS.git
synced 2025-04-15 00:04:00 -04:00
Avoid crash when disconnecting layer
This commit is contained in:
parent
8da2910993
commit
6c97fcf80f
@ -265,6 +265,7 @@ void QgsGeometryValidationDock::onCurrentLayerChanged( QgsMapLayer *layer )
|
||||
{
|
||||
disconnect( mCurrentLayer, &QgsVectorLayer::editingStarted, this, &QgsGeometryValidationDock::onLayerEditingStatusChanged );
|
||||
disconnect( mCurrentLayer, &QgsVectorLayer::editingStopped, this, &QgsGeometryValidationDock::onLayerEditingStatusChanged );
|
||||
disconnect( mCurrentLayer, &QgsVectorLayer::destroyed, this, &QgsGeometryValidationDock::onLayerDestroyed );
|
||||
}
|
||||
|
||||
mCurrentLayer = qobject_cast<QgsVectorLayer *>( layer );
|
||||
@ -273,6 +274,7 @@ void QgsGeometryValidationDock::onCurrentLayerChanged( QgsMapLayer *layer )
|
||||
{
|
||||
connect( mCurrentLayer, &QgsVectorLayer::editingStarted, this, &QgsGeometryValidationDock::onLayerEditingStatusChanged );
|
||||
connect( mCurrentLayer, &QgsVectorLayer::editingStopped, this, &QgsGeometryValidationDock::onLayerEditingStatusChanged );
|
||||
connect( mCurrentLayer, &QgsVectorLayer::destroyed, this, &QgsGeometryValidationDock::onLayerDestroyed );
|
||||
}
|
||||
|
||||
onLayerEditingStatusChanged();
|
||||
@ -297,6 +299,12 @@ void QgsGeometryValidationDock::onLayerEditingStatusChanged()
|
||||
mTopologyChecksPendingButton->setEnabled( enabled );
|
||||
}
|
||||
|
||||
void QgsGeometryValidationDock::onLayerDestroyed( QObject *layer )
|
||||
{
|
||||
if ( layer == mCurrentLayer )
|
||||
mCurrentLayer = nullptr;
|
||||
}
|
||||
|
||||
void QgsGeometryValidationDock::showHighlight( const QModelIndex ¤t )
|
||||
{
|
||||
QgsVectorLayer *vlayer = qobject_cast<QgsVectorLayer *>( mMapCanvas->currentLayer() );
|
||||
|
@ -48,6 +48,7 @@ class QgsGeometryValidationDock : public QgsDockWidget, public Ui_QgsGeometryVal
|
||||
void onCurrentErrorChanged( const QModelIndex ¤t, const QModelIndex &previous );
|
||||
void onCurrentLayerChanged( QgsMapLayer *layer );
|
||||
void onLayerEditingStatusChanged();
|
||||
void onLayerDestroyed( QObject *layer );
|
||||
void gotoNextError();
|
||||
void gotoPreviousError();
|
||||
void zoomToProblem();
|
||||
|
Loading…
x
Reference in New Issue
Block a user