Skip to content

Commit b69e076

Browse files
committed
Fix some leaks
1 parent 4eb53d3 commit b69e076

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

src/app/qgsapplayertreeviewmenuprovider.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ QMenu* QgsAppLayerTreeViewMenuProvider::createContextMenu()
9999
// style-related actions
100100
if ( layer && mView->selectedLayerNodes().count() == 1 )
101101
{
102-
QMenu *menuStyleManager = new QMenu( tr( "Styles" ) );
102+
QMenu *menuStyleManager = new QMenu( tr( "Styles" ), menu );
103103

104104
QgisApp *app = QgisApp::instance();
105105
menuStyleManager->addAction( tr( "Copy Style" ), app, SLOT( copyStyle() ) );

src/app/qgsmaplayerstyleguiutils.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,12 @@ QList<QAction*> QgsMapLayerStyleGuiUtils::actionsUseStyle( QgsMapLayer* layer, Q
8181

8282
void QgsMapLayerStyleGuiUtils::addStyleManagerActions( QMenu* m, QgsMapLayer* layer )
8383
{
84-
m->addAction( actionAddStyle( layer ) );
84+
m->addAction( actionAddStyle( layer, m ) );
8585
if ( layer->styleManager()->styles().count() > 1 )
86-
m->addAction( actionRemoveStyle( layer ) );
87-
m->addAction( actionRenameStyle( layer ) );
86+
m->addAction( actionRemoveStyle( layer, m ) );
87+
m->addAction( actionRenameStyle( layer, m ) );
8888
m->addSeparator();
89-
Q_FOREACH ( QAction* a, actionsUseStyle( layer ) )
89+
Q_FOREACH ( QAction* a, actionsUseStyle( layer, m ) )
9090
m->addAction( a );
9191
}
9292

src/app/qgsmaptooladdfeature.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,7 @@ void QgsMapToolAddFeature::cadCanvasReleaseEvent( QgsMapMouseEvent* e )
213213
}
214214

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

218218
//does compoundcurve contain circular strings?
219219
//does provider support circular strings?
@@ -258,7 +258,6 @@ void QgsMapToolAddFeature::cadCanvasReleaseEvent( QgsMapMouseEvent* e )
258258
{
259259
//bail out...
260260
emit messageEmitted( tr( "The feature could not be added because removing the polygon intersections would change the geometry type" ), QgsMessageBar::CRITICAL );
261-
delete f;
262261
stopCapturing();
263262
return;
264263
}
@@ -280,13 +279,12 @@ void QgsMapToolAddFeature::cadCanvasReleaseEvent( QgsMapMouseEvent* e )
280279
reason = tr( "The feature cannot be added because it's geometry collapsed due to intersection avoidance" );
281280
}
282281
emit messageEmitted( reason, QgsMessageBar::CRITICAL );
283-
delete f;
284282
stopCapturing();
285283
return;
286284
}
287285
}
288286

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

0 commit comments

Comments
 (0)