Navigation Menu

Skip to content

Commit

Permalink
Avoid crash from storage of potentially removed map layer storage in …
Browse files Browse the repository at this point in the history
…canvas

(cherry-picked from 56b6ebd)
  • Loading branch information
nyalldawson committed Aug 17, 2018
1 parent 6fd5b23 commit cddbf96
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/gui/qgsmapcanvas.cpp
Expand Up @@ -285,6 +285,9 @@ QgsMapLayer *QgsMapCanvas::layer( int index )

void QgsMapCanvas::setCurrentLayer( QgsMapLayer *layer )
{
if ( mCurrentLayer == layer )
return;

mCurrentLayer = layer;
emit currentLayerChanged( layer );
}
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsmapcanvas.h
Expand Up @@ -917,7 +917,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;
Expand Down

0 comments on commit cddbf96

Please sign in to comment.