Skip to content

Commit

Permalink
Fix some leaks
Browse files Browse the repository at this point in the history
  • Loading branch information
nyalldawson committed Oct 10, 2015
1 parent 4eb53d3 commit b69e076
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/app/qgsapplayertreeviewmenuprovider.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ QMenu* QgsAppLayerTreeViewMenuProvider::createContextMenu()
// style-related actions
if ( layer && mView->selectedLayerNodes().count() == 1 )
{
QMenu *menuStyleManager = new QMenu( tr( "Styles" ) );
QMenu *menuStyleManager = new QMenu( tr( "Styles" ), menu );

QgisApp *app = QgisApp::instance();
menuStyleManager->addAction( tr( "Copy Style" ), app, SLOT( copyStyle() ) );
Expand Down
8 changes: 4 additions & 4 deletions src/app/qgsmaplayerstyleguiutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ QList<QAction*> QgsMapLayerStyleGuiUtils::actionsUseStyle( QgsMapLayer* layer, Q

void QgsMapLayerStyleGuiUtils::addStyleManagerActions( QMenu* m, QgsMapLayer* layer )
{
m->addAction( actionAddStyle( layer ) );
m->addAction( actionAddStyle( layer, m ) );
if ( layer->styleManager()->styles().count() > 1 )
m->addAction( actionRemoveStyle( layer ) );
m->addAction( actionRenameStyle( layer ) );
m->addAction( actionRemoveStyle( layer, m ) );
m->addAction( actionRenameStyle( layer, m ) );
m->addSeparator();
Q_FOREACH ( QAction* a, actionsUseStyle( layer ) )
Q_FOREACH ( QAction* a, actionsUseStyle( layer, m ) )
m->addAction( a );
}

Expand Down
6 changes: 2 additions & 4 deletions src/app/qgsmaptooladdfeature.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ void QgsMapToolAddFeature::cadCanvasReleaseEvent( QgsMapMouseEvent* e )
}

//create QgsFeature with wkb representation
QgsFeature* f = new QgsFeature( vlayer->fields(), 0 );
QScopedPointer< QgsFeature > f( new QgsFeature( vlayer->fields(), 0 ) );

//does compoundcurve contain circular strings?
//does provider support circular strings?
Expand Down Expand Up @@ -258,7 +258,6 @@ void QgsMapToolAddFeature::cadCanvasReleaseEvent( QgsMapMouseEvent* e )
{
//bail out...
emit messageEmitted( tr( "The feature could not be added because removing the polygon intersections would change the geometry type" ), QgsMessageBar::CRITICAL );
delete f;
stopCapturing();
return;
}
Expand All @@ -280,13 +279,12 @@ void QgsMapToolAddFeature::cadCanvasReleaseEvent( QgsMapMouseEvent* e )
reason = tr( "The feature cannot be added because it's geometry collapsed due to intersection avoidance" );
}
emit messageEmitted( reason, QgsMessageBar::CRITICAL );
delete f;
stopCapturing();
return;
}
}

if ( addFeature( vlayer, f, false ) )
if ( addFeature( vlayer, f.data(), false ) )
{
//add points to other features to keep topology up-to-date
int topologicalEditing = QgsProject::instance()->readNumEntry( "Digitizing", "/TopologicalEditing", 0 );
Expand Down

0 comments on commit b69e076

Please sign in to comment.