Seam allowance tool already initializated and can't init the path.
--HG-- branch : feature
This commit is contained in:
parent
970762d0b3
commit
af51e5e240
|
@ -31,6 +31,7 @@
|
|||
#include "../vpatterndb/vpiecepath.h"
|
||||
#include "../vpatterndb/vpiecenode.h"
|
||||
#include "../../undocommands/savepieceoptions.h"
|
||||
#include "../vtoolseamallowance.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VToolPiecePath *VToolPiecePath::Create(DialogTool *dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
|
||||
|
@ -81,12 +82,24 @@ VToolPiecePath *VToolPiecePath::Create(quint32 _id, const VPiecePath &path, quin
|
|||
pathTool->setParent(tool);// Adopted by a tool
|
||||
}
|
||||
else
|
||||
{
|
||||
if (typeCreation == Source::FromGui && path.GetType() == PiecePathType::InternalPath)
|
||||
{ // Seam allowance tool already initializated and can't init the path
|
||||
SCASSERT(pieceId > NULL_ID);
|
||||
VToolSeamAllowance *saTool = qobject_cast<VToolSeamAllowance*>(doc->getTool(pieceId));
|
||||
SCASSERT(saTool != nullptr);
|
||||
pathTool->setParentItem(saTool);
|
||||
pathTool->SetParentType(ParentType::Item);
|
||||
doc->IncrementReferens(id);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Try to prevent memory leak
|
||||
scene->addItem(pathTool);// First adopted by scene
|
||||
pathTool->hide();// If no one will use node, it will stay hidden
|
||||
pathTool->SetParentType(ParentType::Scene);
|
||||
}
|
||||
}
|
||||
return pathTool;
|
||||
}
|
||||
return nullptr;
|
||||
|
|
Loading…
Reference in New Issue
Block a user