Avoid crash from storage of potentially removed map layer storage in canvas

This commit is contained in:
Nyall Dawson 2018-08-17 10:33:24 +10:00
parent 8075368638
commit 56b6ebd91c
2 changed files with 4 additions and 1 deletions

View File

@ -285,6 +285,9 @@ QgsMapLayer *QgsMapCanvas::layer( int index )
void QgsMapCanvas::setCurrentLayer( QgsMapLayer *layer )
{
if ( mCurrentLayer == layer )
return;
mCurrentLayer = layer;
emit currentLayerChanged( layer );
}

View File

@ -928,7 +928,7 @@ class GUI_EXPORT QgsMapCanvas : public QGraphicsView
bool mRenderFlag = true;
//! current layer in legend
QgsMapLayer *mCurrentLayer = nullptr;
QPointer< QgsMapLayer > mCurrentLayer;
//! graphics scene manages canvas items
QGraphicsScene *mScene = nullptr;