Skip to content

Commit

Permalink
destructor fix, delete mCanvasEdit etc.
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@5729 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
rblazek committed Aug 24, 2006
1 parent 3027546 commit 66ef358
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/plugins/grass/qgsgrassedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ bool QgsGrassEdit::mRunning = false;
QgsGrassEdit::QgsGrassEdit ( QgisApp *qgisApp, QgisIface *iface,
QWidget * parent, Qt::WFlags f )
:QMainWindow(parent,f), QgsGrassEditBase (), mMapTool(0),
mCanvasEdit(0), mRubberBandLine(0), mRubberBandIcon(0)
mCanvasEdit(0), mRubberBandLine(0), mRubberBandIcon(0), mInited(false)
{
#ifdef QGISDEBUG
std::cerr << "QgsGrassEdit()" << std::endl;
Expand Down Expand Up @@ -195,7 +195,7 @@ QgsGrassEdit::QgsGrassEdit ( QgisApp *qgisApp, QgisIface *iface,
QgsGrassProvider *provider,
QWidget * parent, Qt::WFlags f )
:QMainWindow(parent, 0, f), QgsGrassEditBase (), mMapTool(0),
mCanvasEdit(0), mRubberBandLine(0), mRubberBandIcon(0)
mCanvasEdit(0), mRubberBandLine(0), mRubberBandIcon(0), mInited(false)
{
#ifdef QGISDEBUG
std::cerr << "QgsGrassEdit()" << std::endl;
Expand Down Expand Up @@ -539,6 +539,7 @@ void QgsGrassEdit::init()
restorePosition();

mValid = true;
mInited = true;
}

void QgsGrassEdit::attributeTableFieldChanged ( void )
Expand Down Expand Up @@ -920,7 +921,10 @@ QgsGrassEdit::~QgsGrassEdit()
std::cerr << "QgsGrassEdit::~QgsGrassEdit()" << std::endl;
#endif

if (mValid) // we can only call some methods if init was complete
// we can only call some methods if init was complete,
// note that we cannot use mValid because it is disabled before
// destructor is called
if (mInited)
{
if ( mMapTool ) mCanvas->unsetMapTool ( mMapTool );
// TODO: delete tool? Probably
Expand All @@ -931,6 +935,7 @@ QgsGrassEdit::~QgsGrassEdit()
mRubberBandLine->reset();
delete mRubberBandLine;
delete mRubberBandIcon;

delete mCanvasEdit;

mCanvas->refresh();
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/grass/qgsgrassedit.h
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,9 @@ public slots:

//! Status: true - active vector was successfully opened for editing
bool mValid;

//! Initialization complete
bool mInited;

//! QGIS application
QgisApp *mQgisApp;
Expand Down

0 comments on commit 66ef358

Please sign in to comment.