Skip to content

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed
 

‎src/plugins/grass/qgsgrassedit.cpp

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ bool QgsGrassEdit::mRunning = false;
106106

107107
QgsGrassEdit::QgsGrassEdit ( QgisApp *qgisApp, QgisIface *iface,
108108
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)
110111
{
111112
#ifdef QGISDEBUG
112113
std::cerr << "QgsGrassEdit()" << std::endl;
@@ -193,7 +194,8 @@ void QgsGrassEdit::keyPress(QKeyEvent *e)
193194
QgsGrassEdit::QgsGrassEdit ( QgisApp *qgisApp, QgisIface *iface,
194195
QgsGrassProvider *provider,
195196
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)
197199
{
198200
#ifdef QGISDEBUG
199201
std::cerr << "QgsGrassEdit()" << std::endl;
@@ -918,8 +920,11 @@ QgsGrassEdit::~QgsGrassEdit()
918920
std::cerr << "QgsGrassEdit::~QgsGrassEdit()" << std::endl;
919921
#endif
920922

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+
923928
eraseDynamic();
924929
mRubberBandLine->hide();
925930
mRubberBandIcon->hide();
@@ -928,15 +933,11 @@ QgsGrassEdit::~QgsGrassEdit()
928933
delete mRubberBandIcon;
929934
delete mCanvasEdit;
930935

931-
if ( mMapTool ) mCanvas->unsetMapTool ( mMapTool );
932-
// TODO: delete tool? Probably
933-
934936
mCanvas->refresh();
937+
938+
saveWindowLocation();
935939
}
936-
937-
saveWindowLocation();
938940
mRunning = false;
939-
940941
}
941942

942943
bool QgsGrassEdit::isRunning(void)

0 commit comments

Comments
 (0)
Please sign in to comment.