Skip to content

Commit b548ac8

Browse files
committed
fix crash when maptool of a plugin is active on exit
1 parent 7f7118c commit b548ac8

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/gui/qgsmaptool.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,16 @@ void QgsMapTool::deactivate()
9898

9999
void QgsMapTool::setAction( QAction* action )
100100
{
101+
if( mAction )
102+
disconnect( mAction, SIGNAL( destroyed() ), this, SLOT( actionDestroyed() ) );
101103
mAction = action;
104+
connect( mAction, SIGNAL( destroyed() ), this, SLOT( actionDestroyed() ) );
105+
}
106+
107+
void QgsMapTool::actionDestroyed()
108+
{
109+
if( mAction == sender() )
110+
mAction = 0;
102111
}
103112

104113
QAction* QgsMapTool::action()

src/gui/qgsmaptool.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,10 @@ class GUI_EXPORT QgsMapTool : public QObject
153153
//! emit signal to clear previous message
154154
void messageDiscarded();
155155

156+
private slots:
157+
//! clear pointer when action is destroyed
158+
void actionDestroyed();
159+
156160
protected:
157161

158162
//! constructor takes map canvas as a parameter

0 commit comments

Comments
 (0)