Skip to content

Commit

Permalink
Fix crash on exit when topology checker dock is open with visible res…
Browse files Browse the repository at this point in the history
…ults
  • Loading branch information
nyalldawson committed Oct 5, 2019
1 parent 7693e4e commit 64375ad
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
15 changes: 9 additions & 6 deletions src/plugins/topology/checkDock.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,9 @@ checkDock::checkDock( QgisInterface *qIface, QWidget *parent )
mTestTable = mConfigureDialog->rulesTable();

QgsMapCanvas *canvas = qIface->mapCanvas();// mQgisApp->mapCanvas();
mRBFeature1 = new QgsRubberBand( canvas );
mRBFeature2 = new QgsRubberBand( canvas );
mRBConflict = new QgsRubberBand( canvas );
mRBFeature1.reset( new QgsRubberBand( canvas ) );
mRBFeature2.reset( new QgsRubberBand( canvas ) );
mRBConflict.reset( new QgsRubberBand( canvas ) );

mRBFeature1->setColor( QColor( 0, 0, 255, 65 ) );
mRBFeature2->setColor( QColor( 0, 255, 0, 65 ) );
Expand Down Expand Up @@ -130,9 +130,12 @@ void checkDock::updateRubberBands( bool visible )
{
if ( !visible )
{
mRBConflict->reset();
mRBFeature1->reset();
mRBFeature2->reset();
if ( mRBConflict )
mRBConflict->reset();
if ( mRBFeature1 )
mRBFeature1->reset();
if ( mRBFeature2 )
mRBFeature2->reset();

clearVertexMarkers();
}
Expand Down
8 changes: 5 additions & 3 deletions src/plugins/topology/checkDock.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
#include "topolError.h"
#include "topolTest.h"
#include "dockModel.h"
#include "qobjectuniqueptr.h"

class QgsRubberBand;
class QgsVertexMarker;
Expand Down Expand Up @@ -109,9 +110,10 @@ class checkDock : public QgsDockWidget, private Ui::checkDock
private:
rulesDialog *mConfigureDialog = nullptr;

QgsRubberBand *mRBConflict = nullptr;
QgsRubberBand *mRBFeature1 = nullptr;
QgsRubberBand *mRBFeature2 = nullptr;
QObjectUniquePtr<QgsRubberBand> mRBConflict;
QObjectUniquePtr<QgsRubberBand> mRBFeature1;
QObjectUniquePtr<QgsRubberBand> mRBFeature2;

QgsVertexMarker *mVMConflict = nullptr;
QgsVertexMarker *mVMFeature1 = nullptr;
QgsVertexMarker *mVMFeature2 = nullptr;
Expand Down

0 comments on commit 64375ad

Please sign in to comment.