Fix memory leak.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-12-21 21:39:44 +02:00
parent a6a8ef29b0
commit 3a8fd53dc8

View File

@ -1229,7 +1229,7 @@ void VToolDetail::RefreshGeometry()
//---------------------------------------------------------------------------------------------------------------------
void VToolDetail::DeleteTool(bool ask)
{
DeleteDetail *delDet = new DeleteDetail(doc, id, VAbstractTool::data.GetDetail(id));
QScopedPointer<DeleteDetail> delDet(new DeleteDetail(doc, id, VAbstractTool::data.GetDetail(id)));
if (ask)
{
if (ConfirmDeletion() == QMessageBox::No)
@ -1237,9 +1237,9 @@ void VToolDetail::DeleteTool(bool ask)
return;
}
/* If UnionDetails tool delete detail no need emit FullParsing.*/
connect(delDet, &DeleteDetail::NeedFullParsing, doc, &VAbstractPattern::NeedFullParsing);
connect(delDet.data(), &DeleteDetail::NeedFullParsing, doc, &VAbstractPattern::NeedFullParsing);
}
qApp->getUndoStack()->push(delDet);
qApp->getUndoStack()->push(delDet.take());
// Throw exception, this will help prevent case when we forget to immediately quit function.
VExceptionToolWasDeleted e("Tool was used after deleting.");