Skip to content
Permalink
Browse files

Fix some minor memory leaks

  • Loading branch information
nyalldawson committed May 10, 2016
1 parent 6b80518 commit c32966d872be2cff94728076f56c7b8c6bc5f1aa
Showing with 19 additions and 20 deletions.
  1. +2 −3 src/app/qgisapp.cpp
  2. +9 −9 src/gui/qgsadvanceddigitizingdockwidget.cpp
  3. +8 −8 src/gui/qgsadvanceddigitizingdockwidget.h
@@ -675,10 +675,9 @@ QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, bool skipVersionCh
mLayerTreeView->setObjectName( "theLayerTreeView" ); // "theLayerTreeView" used to find this canonical instance later

// create undo widget
mUndoWidget = new QgsUndoWidget( nullptr, mMapCanvas );
mUndoDock = new QDockWidget( tr( "Undo/Redo Panel" ), this );
mUndoWidget = new QgsUndoWidget( mUndoDock, mMapCanvas );
mUndoWidget->setObjectName( "Undo" );

mUndoDock = new QDockWidget( tr( "Undo/Redo Panel" ), nullptr );
mUndoDock->setWidget( mUndoWidget );

// Advanced Digitizing dock
@@ -103,10 +103,10 @@ QgsAdvancedDigitizingDockWidget::QgsAdvancedDigitizingDockWidget( QgsMapCanvas*

mCadPaintItem = new QgsAdvancedDigitizingCanvasItem( canvas, this ) ;

mAngleConstraint = new CadConstraint( mAngleLineEdit, mLockAngleButton, mRelativeAngleButton, mRepeatingLockAngleButton );
mDistanceConstraint = new CadConstraint( mDistanceLineEdit, mLockDistanceButton, nullptr, mRepeatingLockDistanceButton ) ;
mXConstraint = new CadConstraint( mXLineEdit, mLockXButton, mRelativeXButton, mRepeatingLockXButton );
mYConstraint = new CadConstraint( mYLineEdit, mLockYButton, mRelativeYButton, mRepeatingLockYButton ) ;
mAngleConstraint.reset( new CadConstraint( mAngleLineEdit, mLockAngleButton, mRelativeAngleButton, mRepeatingLockAngleButton ) );
mDistanceConstraint.reset( new CadConstraint( mDistanceLineEdit, mLockDistanceButton, nullptr, mRepeatingLockDistanceButton ) );
mXConstraint.reset( new CadConstraint( mXLineEdit, mLockXButton, mRelativeXButton, mRepeatingLockXButton ) );
mYConstraint.reset( new CadConstraint( mYLineEdit, mLockYButton, mRelativeYButton, mRepeatingLockYButton ) );
mAdditionalConstraint = NoConstraint ;

mMapCanvas->installEventFilter( this );
@@ -347,19 +347,19 @@ QgsAdvancedDigitizingDockWidget::CadConstraint* QgsAdvancedDigitizingDockWidget:
CadConstraint* constraint = nullptr;
if ( obj == mAngleLineEdit || obj == mLockAngleButton )
{
constraint = mAngleConstraint;
constraint = mAngleConstraint.data();
}
else if ( obj == mDistanceLineEdit || obj == mLockDistanceButton )
{
constraint = mDistanceConstraint;
constraint = mDistanceConstraint.data();
}
else if ( obj == mXLineEdit || obj == mLockXButton )
{
constraint = mXConstraint;
constraint = mXConstraint.data();
}
else if ( obj == mYLineEdit || obj == mLockYButton )
{
constraint = mYConstraint;
constraint = mYConstraint.data();
}
return constraint;
}
@@ -439,7 +439,7 @@ void QgsAdvancedDigitizingDockWidget::lockConstraint( bool activate /* default t
if ( activate )
{
// deactivate perpendicular/parallel if angle has been activated
if ( constraint == mAngleConstraint )
if ( constraint == mAngleConstraint.data() )
{
lockAdditionalConstraint( NoConstraint );
}
@@ -256,13 +256,13 @@ class GUI_EXPORT QgsAdvancedDigitizingDockWidget : public QDockWidget, private U
//! Additional constraints are used to place perpendicular/parallel segments to snapped segments on the canvas
AdditionalConstraint additionalConstraint() const { return mAdditionalConstraint; }
//! Constraint on the angle
const CadConstraint* constraintAngle() const { return mAngleConstraint; }
const CadConstraint* constraintAngle() const { return mAngleConstraint.data(); }
//! Constraint on the distance
const CadConstraint* constraintDistance() const { return mDistanceConstraint; }
const CadConstraint* constraintDistance() const { return mDistanceConstraint.data(); }
//! Constraint on the X coordinate
const CadConstraint* constraintX() const { return mXConstraint; }
const CadConstraint* constraintX() const { return mXConstraint.data(); }
//! Constraint on the Y coordinate
const CadConstraint* constraintY() const { return mYConstraint; }
const CadConstraint* constraintY() const { return mYConstraint.data(); }
//! Constraint on a common angle
bool commonAngleConstraint() const { return mCommonAngleConstraint; }

@@ -439,10 +439,10 @@ class GUI_EXPORT QgsAdvancedDigitizingDockWidget : public QDockWidget, private U
QgsMapMouseEvent::SnappingMode mSnappingMode;

// constraints
CadConstraint* mAngleConstraint;
CadConstraint* mDistanceConstraint;
CadConstraint* mXConstraint;
CadConstraint* mYConstraint;
QScopedPointer< CadConstraint > mAngleConstraint;
QScopedPointer< CadConstraint > mDistanceConstraint;
QScopedPointer< CadConstraint > mXConstraint;
QScopedPointer< CadConstraint > mYConstraint;
AdditionalConstraint mAdditionalConstraint;
int mCommonAngleConstraint; // if 0: do not snap to common angles

0 comments on commit c32966d

Please sign in to comment.
You can’t perform that action at this time.