Fix Valentina crash adding internal path did not increment this object

reference.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2017-12-04 14:08:13 +02:00
parent a0ec8ecb64
commit d1ec8e90dd
3 changed files with 4 additions and 0 deletions

View File

@ -241,6 +241,7 @@ void VToolPiecePath::AddToFile()
if (path.GetType() == PiecePathType::InternalPath) if (path.GetType() == PiecePathType::InternalPath)
{ {
newDet.GetInternalPaths().append(m_id); newDet.GetInternalPaths().append(m_id);
incrementReferens(); // Manually increment reference since in this case a piece tool will not do this for us
} }
else if (path.GetType() == PiecePathType::CustomSeamAllowance) else if (path.GetType() == PiecePathType::CustomSeamAllowance)
{ {
@ -248,6 +249,7 @@ void VToolPiecePath::AddToFile()
record.path = m_id; record.path = m_id;
newDet.GetCustomSARecords().append(record); newDet.GetCustomSARecords().append(record);
incrementReferens(); // Manually increment reference since in this case a piece tool will not do this for us
} }
qApp->getUndoStack()->push(new SavePieceOptions(oldDet, newDet, doc, m_pieceId)); qApp->getUndoStack()->push(new SavePieceOptions(oldDet, newDet, doc, m_pieceId));

View File

@ -147,6 +147,7 @@ void VToolPin::AddToFile()
VPiece newDet = oldDet; VPiece newDet = oldDet;
newDet.GetPins().append(m_id); newDet.GetPins().append(m_id);
incrementReferens(); // Manually increment reference since in this case a piece tool will not do this for us
qApp->getUndoStack()->push(new SavePieceOptions(oldDet, newDet, doc, m_pieceId)); qApp->getUndoStack()->push(new SavePieceOptions(oldDet, newDet, doc, m_pieceId));
} }

View File

@ -197,6 +197,7 @@ void VToolPlaceLabel::AddToFile()
VPiece newDet = oldDet; VPiece newDet = oldDet;
newDet.GetPlaceLabels().append(m_id); newDet.GetPlaceLabels().append(m_id);
incrementReferens(); // Manually increment reference since in this case a piece tool will not do this for us
qApp->getUndoStack()->push(new SavePieceOptions(oldDet, newDet, doc, m_pieceId)); qApp->getUndoStack()->push(new SavePieceOptions(oldDet, newDet, doc, m_pieceId));
} }
} }