fix crash when maptool of a plugin is active on exit

This commit is contained in:
Juergen E. Fischer 2014-04-25 12:28:30 +02:00
parent 7f7118ccfb
commit b548ac8c5c
2 changed files with 13 additions and 0 deletions

View File

@ -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()

View File

@ -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