summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFriedrich W. H. Kossebau <kossebau@kde.org>2016-10-13 04:51:29 (GMT)
committerFriedrich W. H. Kossebau <kossebau@kde.org>2016-10-13 04:51:29 (GMT)
commit757ca724e27df8acc2b37ba845f5e31a5d214209 (patch)
treef1bbc458c4a6fa3cad20065d5b8800eb1b35e479
parentdd9ae7ee4112e9a1aa1ffe968951b6b8f63ade09 (diff)
Fix memory leak: delete OsmRelationEditorDialog also on cancelling
-rw-r--r--src/lib/marble/osm/OsmRelationEditorDialog.cpp1
-rw-r--r--src/lib/marble/osm/OsmRelationManagerWidget.cpp12
2 files changed, 7 insertions, 6 deletions
diff --git a/src/lib/marble/osm/OsmRelationEditorDialog.cpp b/src/lib/marble/osm/OsmRelationEditorDialog.cpp
index 67577fe..76eacd3 100644
--- a/src/lib/marble/osm/OsmRelationEditorDialog.cpp
+++ b/src/lib/marble/osm/OsmRelationEditorDialog.cpp
@@ -78,7 +78,6 @@ void OsmRelationEditorDialog::finish()
m_dummyPlacemark->osmData().addTag(QStringLiteral("name"), m_nameLineEdit->text());
*m_relationData = m_dummyPlacemark->osmData();
accept();
- deleteLater();
}
void OsmRelationEditorDialog::checkFields()
diff --git a/src/lib/marble/osm/OsmRelationManagerWidget.cpp b/src/lib/marble/osm/OsmRelationManagerWidget.cpp
index bb031d9..42858b1 100644
--- a/src/lib/marble/osm/OsmRelationManagerWidget.cpp
+++ b/src/lib/marble/osm/OsmRelationManagerWidget.cpp
@@ -73,12 +73,12 @@ void OsmRelationManagerWidget::addRelation( QAction *relationAction )
if ( relationText == tr( "New Relation" ) ) {
OsmPlacemarkData relationData;
QPointer<OsmRelationEditorDialog> relationEditor = new OsmRelationEditorDialog( &relationData );
- if ( relationEditor->exec() == QDialog::Rejected ) {
+ const int result = relationEditor->exec();
+ delete relationEditor;
+ if (result == QDialog::Rejected) {
return;
}
- delete relationEditor;
-
QTreeWidgetItem *newRelationItem = new QTreeWidgetItem();
newRelationItem->setText(Column::Name, relationData.tagValue(QStringLiteral("name")));
newRelationItem->setText(Column::Type, relationData.tagValue(QStringLiteral("type")));
@@ -159,10 +159,12 @@ void OsmRelationManagerWidget::handleRelationContextMenuRequest( const QPoint& p
else if ( selectedItem->text() == tr( "Edit" ) ) {
OsmPlacemarkData relationData = d->m_allRelations->value( id );
QPointer<OsmRelationEditorDialog> relationEditor = new OsmRelationEditorDialog( &relationData );
- if ( relationEditor->exec() == QDialog::Rejected ) {
+ const int result = relationEditor->exec();
+ delete relationEditor;
+ if (result == QDialog::Rejected) {
return;
}
- delete relationEditor;
+
emit relationCreated( relationData );
update();
}