Skip to content

Commit

Permalink
fix crash when maptool of a plugin is active on exit
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Apr 25, 2014
1 parent 7f7118c commit b548ac8
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/gui/qgsmaptool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,16 @@ void QgsMapTool::deactivate()

void QgsMapTool::setAction( QAction* action )
{
if( mAction )
disconnect( mAction, SIGNAL( destroyed() ), this, SLOT( actionDestroyed() ) );
mAction = action;
connect( mAction, SIGNAL( destroyed() ), this, SLOT( actionDestroyed() ) );
}

void QgsMapTool::actionDestroyed()
{
if( mAction == sender() )
mAction = 0;
}

QAction* QgsMapTool::action()
Expand Down
4 changes: 4 additions & 0 deletions src/gui/qgsmaptool.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,10 @@ class GUI_EXPORT QgsMapTool : public QObject
//! emit signal to clear previous message
void messageDiscarded();

private slots:
//! clear pointer when action is destroyed
void actionDestroyed();

protected:

//! constructor takes map canvas as a parameter
Expand Down

0 comments on commit b548ac8

Please sign in to comment.