@@ -106,7 +106,8 @@ bool QgsGrassEdit::mRunning = false;
106
106
107
107
QgsGrassEdit::QgsGrassEdit ( QgisApp *qgisApp, QgisIface *iface,
108
108
QWidget * parent, Qt::WFlags f )
109
- :QMainWindow(parent,f), QgsGrassEditBase (), mMapTool(0 )
109
+ :QMainWindow(parent,f), QgsGrassEditBase (), mMapTool(0 ),
110
+ mCanvasEdit(0 ), mRubberBandLine(0 ), mRubberBandIcon(0 )
110
111
{
111
112
#ifdef QGISDEBUG
112
113
std::cerr << " QgsGrassEdit()" << std::endl;
@@ -193,7 +194,8 @@ void QgsGrassEdit::keyPress(QKeyEvent *e)
193
194
QgsGrassEdit::QgsGrassEdit ( QgisApp *qgisApp, QgisIface *iface,
194
195
QgsGrassProvider *provider,
195
196
QWidget * parent, Qt::WFlags f )
196
- :QMainWindow(parent, 0 , f), QgsGrassEditBase (), mMapTool(0 )
197
+ :QMainWindow(parent, 0 , f), QgsGrassEditBase (), mMapTool(0 ),
198
+ mCanvasEdit(0 ), mRubberBandLine(0 ), mRubberBandIcon(0 )
197
199
{
198
200
#ifdef QGISDEBUG
199
201
std::cerr << " QgsGrassEdit()" << std::endl;
@@ -918,8 +920,11 @@ QgsGrassEdit::~QgsGrassEdit()
918
920
std::cerr << " QgsGrassEdit::~QgsGrassEdit()" << std::endl;
919
921
#endif
920
922
921
- if (mCanvasEdit ) {
922
-
923
+ if (mValid ) // we can only call some methods if init was complete
924
+ {
925
+ if ( mMapTool ) mCanvas ->unsetMapTool ( mMapTool );
926
+ // TODO: delete tool? Probably
927
+
923
928
eraseDynamic ();
924
929
mRubberBandLine ->hide ();
925
930
mRubberBandIcon ->hide ();
@@ -928,15 +933,11 @@ QgsGrassEdit::~QgsGrassEdit()
928
933
delete mRubberBandIcon ;
929
934
delete mCanvasEdit ;
930
935
931
- if ( mMapTool ) mCanvas ->unsetMapTool ( mMapTool );
932
- // TODO: delete tool? Probably
933
-
934
936
mCanvas ->refresh ();
937
+
938
+ saveWindowLocation ();
935
939
}
936
-
937
- saveWindowLocation ();
938
940
mRunning = false ;
939
-
940
941
}
941
942
942
943
bool QgsGrassEdit::isRunning (void )
0 commit comments