Skip to content

Commit 7030b1a

Browse files
committed
fix crash in coordinate capture plugin
1 parent e9ca0bb commit 7030b1a

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

src/plugins/coordinate_capture/coordinatecapture.cpp

+12-6
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,6 @@ void CoordinateCapture::initGui()
114114
connect( mpMapTool, SIGNAL( mouseMoved( QgsPoint ) ), this, SLOT( mouseMoved( QgsPoint ) ) );
115115
connect( mpMapTool, SIGNAL( mouseClicked( QgsPoint ) ), this, SLOT( mouseClicked( QgsPoint ) ) );
116116

117-
118117
// create a little widget with x and y display to put into our dock widget
119118
QWidget * mypWidget = new QWidget();
120119
QGridLayout *mypLayout = new QGridLayout( mypWidget );
@@ -264,19 +263,26 @@ void CoordinateCapture::unload()
264263
mQGisIface->removeVectorToolBarIcon( mQActionPointer );
265264
mpMapTool->deactivate();
266265
delete mpMapTool;
266+
mpMapTool = 0;
267267
delete mpDockWidget;
268+
mpDockWidget = 0;
268269
delete mQActionPointer;
270+
mQActionPointer = 0;
269271
}
270272

271273
// Set icons to the current theme
272274
void CoordinateCapture::setCurrentTheme( QString theThemeName )
273275
{
274276
Q_UNUSED( theThemeName );
275-
mQActionPointer->setIcon( QIcon( getIconPath( "coordinate_capture.png" ) ) );
276-
mpTrackMouseButton->setIcon( QIcon( getIconPath( "tracking.png" ) ) );
277-
mpCaptureButton->setIcon( QIcon( getIconPath( "coordinate_capture.png" ) ) );
278-
mypUserCrsToolButton->setIcon( QIcon( getIconPath( "geographic.png" ) ) );
279-
mypCRSLabel->setPixmap( QPixmap( getIconPath( "transformed.png" ) ) );
277+
if ( mQActionPointer )
278+
mQActionPointer->setIcon( QIcon( getIconPath( "coordinate_capture.png" ) ) );
279+
if ( mpDockWidget )
280+
{
281+
mpTrackMouseButton->setIcon( QIcon( getIconPath( "tracking.png" ) ) );
282+
mpCaptureButton->setIcon( QIcon( getIconPath( "coordinate_capture.png" ) ) );
283+
mypUserCrsToolButton->setIcon( QIcon( getIconPath( "geographic.png" ) ) );
284+
mypCRSLabel->setPixmap( QPixmap( getIconPath( "transformed.png" ) ) );
285+
}
280286
}
281287

282288
// Get path to the best available icon file

0 commit comments

Comments
 (0)