@@ -107,7 +107,7 @@ bool QgsGrassEdit::mRunning = false;
107
107
QgsGrassEdit::QgsGrassEdit ( QgisApp *qgisApp, QgisIface *iface,
108
108
QWidget * parent, Qt::WFlags f )
109
109
:QMainWindow(parent,f), QgsGrassEditBase (), mMapTool(0 ),
110
- mCanvasEdit(0 ), mRubberBandLine(0 ), mRubberBandIcon(0 )
110
+ mCanvasEdit(0 ), mRubberBandLine(0 ), mRubberBandIcon(0 ), mInited( false )
111
111
{
112
112
#ifdef QGISDEBUG
113
113
std::cerr << " QgsGrassEdit()" << std::endl;
@@ -195,7 +195,7 @@ QgsGrassEdit::QgsGrassEdit ( QgisApp *qgisApp, QgisIface *iface,
195
195
QgsGrassProvider *provider,
196
196
QWidget * parent, Qt::WFlags f )
197
197
:QMainWindow(parent, 0 , f), QgsGrassEditBase (), mMapTool(0 ),
198
- mCanvasEdit(0 ), mRubberBandLine(0 ), mRubberBandIcon(0 )
198
+ mCanvasEdit(0 ), mRubberBandLine(0 ), mRubberBandIcon(0 ), mInited( false )
199
199
{
200
200
#ifdef QGISDEBUG
201
201
std::cerr << " QgsGrassEdit()" << std::endl;
@@ -539,6 +539,7 @@ void QgsGrassEdit::init()
539
539
restorePosition ();
540
540
541
541
mValid = true ;
542
+ mInited = true ;
542
543
}
543
544
544
545
void QgsGrassEdit::attributeTableFieldChanged ( void )
@@ -920,7 +921,10 @@ QgsGrassEdit::~QgsGrassEdit()
920
921
std::cerr << " QgsGrassEdit::~QgsGrassEdit()" << std::endl;
921
922
#endif
922
923
923
- if (mValid ) // we can only call some methods if init was complete
924
+ // we can only call some methods if init was complete,
925
+ // note that we cannot use mValid because it is disabled before
926
+ // destructor is called
927
+ if (mInited )
924
928
{
925
929
if ( mMapTool ) mCanvas ->unsetMapTool ( mMapTool );
926
930
// TODO: delete tool? Probably
@@ -931,6 +935,7 @@ QgsGrassEdit::~QgsGrassEdit()
931
935
mRubberBandLine ->reset ();
932
936
delete mRubberBandLine ;
933
937
delete mRubberBandIcon ;
938
+
934
939
delete mCanvasEdit ;
935
940
936
941
mCanvas ->refresh ();
0 commit comments