# HG changeset patch
# User Teemu Piippo <teemu@hecknology.net>
# Date 1486663665 -7200
# Node ID d1d8be74275b388a71568903a1b32a41c23ff68b
# Parent  471572db2fe13cae9a2214531b081daa5930fc79
Fixed potential memory leak

diff -r 471572db2fe1 -r d1d8be74275b src/toolsets/algorithmtoolset.cpp
--- a/src/toolsets/algorithmtoolset.cpp	Thu Feb 09 19:59:27 2017 +0200
+++ b/src/toolsets/algorithmtoolset.cpp	Thu Feb 09 20:07:45 2017 +0200
@@ -334,12 +334,12 @@
 	bool ishistory = false;
 	bool prevIsHistory = false;
 
-	QDialog* dlg = new QDialog;
-	Ui_AddHistoryLine* ui = new Ui_AddHistoryLine;
-	ui->setupUi (dlg);
-	ui->m_username->setText (m_config->defaultUser());
-	ui->m_date->setDate (QDate::currentDate());
-	ui->m_comment->setFocus();
+	QDialog* dlg = new QDialog {m_window};
+	Ui_AddHistoryLine ui;
+	ui.setupUi(dlg);
+	ui.m_username->setText (m_config->defaultUser());
+	ui.m_date->setDate (QDate::currentDate());
+	ui.m_comment->setFocus();
 
 	if (not dlg->exec())
 		return;
@@ -364,9 +364,9 @@
 
 	// Create the comment object based on input
 	currentDocument()->emplaceAt<LDComment>(idx++, format("!HISTORY %1 [%2] %3",
-	    ui->m_date->date().toString ("yyyy-MM-dd"),
-	    ui->m_username->text(),
-	    ui->m_comment->text()));
+	    ui.m_date->date().toString ("yyyy-MM-dd"),
+	    ui.m_username->text(),
+	    ui.m_comment->text()));
 
 	// If we're adding a history line right before a scemantic object, pad it
 	// an empty line
@@ -374,7 +374,6 @@
 		currentDocument()->emplaceAt<LDEmpty>(idx);
 
 	m_window->buildObjectList();
-	delete ui;
 }
 
 void AlgorithmToolset::splitLines()