Fixed crash when detail use curve created by tool rotation.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-05-25 10:41:00 +03:00
parent f7736d3bfd
commit ff34f05b34
4 changed files with 21 additions and 57 deletions

View File

@ -63,7 +63,15 @@ void VAbstractNode::incrementReferens()
++_referens;
if (_referens == 1)
{
idTool != NULL_ID ? doc->IncrementReferens(idTool) : doc->IncrementReferens(idNode);
if (idTool != NULL_ID)
{
doc->IncrementReferens(idTool);
}
else
{
const QSharedPointer<VGObject> node = VAbstractTool::data.GetGObject(idNode);
doc->IncrementReferens(node->getIdTool());
}
ShowNode();
QDomElement domElement = doc->elementById(id);
if (domElement.isElement())
@ -85,7 +93,15 @@ void VAbstractNode::decrementReferens()
}
if (_referens == 0)
{
idTool != NULL_ID ? doc->DecrementReferens(idTool) : doc->DecrementReferens(idNode);
if (idTool != NULL_ID)
{
doc->DecrementReferens(idTool);
}
else
{
const QSharedPointer<VGObject> node = VAbstractTool::data.GetGObject(idNode);
doc->DecrementReferens(node->getIdTool());
}
HideNode();
QDomElement domElement = doc->elementById(id);
if (domElement.isElement())

View File

@ -47,8 +47,9 @@ public:
virtual ~VAbstractNode() Q_DECL_OVERRIDE {}
static const QString AttrIdTool;
virtual void ShowVisualization(bool show) Q_DECL_OVERRIDE;
virtual void incrementReferens() Q_DECL_OVERRIDE;
virtual void decrementReferens() Q_DECL_OVERRIDE;
void incrementReferens();
void decrementReferens();
ParentType GetParentType() const;
void SetParentType(const ParentType &value);

View File

@ -121,57 +121,6 @@ QString VNodePoint::getTagName() const
return VAbstractPattern::TagPoint;
}
//---------------------------------------------------------------------------------------------------------------------
void VNodePoint::incrementReferens()
{
++_referens;
if (_referens == 1)
{
if (idTool != NULL_ID)
{
doc->IncrementReferens(idTool);
}
else
{
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(idNode);
doc->IncrementReferens(point->getIdTool());
}
ShowNode();
QDomElement domElement = doc->elementById(id);
if (domElement.isElement())
{
doc->SetParametrUsage(domElement, AttrInUse, NodeUsage::InUse);
}
}
}
//---------------------------------------------------------------------------------------------------------------------
void VNodePoint::decrementReferens()
{
if (_referens > 0)
{
--_referens;
}
if (_referens == 0)
{
if (idTool != NULL_ID)
{
doc->DecrementReferens(idTool);
}
else
{
const QSharedPointer<VPointF> point = VAbstractTool::data.GeometricObject<VPointF>(idNode);
doc->DecrementReferens(point->getIdTool());
}
HideNode();
QDomElement domElement = doc->elementById(id);
if (domElement.isElement())
{
doc->SetParametrUsage(domElement, AttrInUse, NodeUsage::NotInUse);
}
}
}
//---------------------------------------------------------------------------------------------------------------------
void VNodePoint::PointChoosed()
{

View File

@ -53,8 +53,6 @@ public:
enum { Type = UserType + static_cast<int>(Tool::NodePoint)};
virtual QString getTagName() const Q_DECL_OVERRIDE;
virtual void incrementReferens() Q_DECL_OVERRIDE;
virtual void decrementReferens() Q_DECL_OVERRIDE;
public slots:
virtual void FullUpdateFromFile() Q_DECL_OVERRIDE;
void NameChangePosition(const QPointF &pos);