Fixed issue #905. Valentina crashes with error: This id is not unique.
(grafted from 0ca6c7805835b3f46bb4e8c2f199e68c804c0820) --HG-- branch : develop
This commit is contained in:
parent
9c2cdad1a8
commit
d13b6e841d
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
# Version 0.6.2 (unreleased)
|
# Version 0.6.2 (unreleased)
|
||||||
- [#903] Bug in tool Cut Spline path.
|
- [#903] Bug in tool Cut Spline path.
|
||||||
|
- [#905] Valentina crashes with error: This id is not unique.
|
||||||
|
|
||||||
# Version 0.6.1 October 23, 2018
|
# Version 0.6.1 October 23, 2018
|
||||||
- [#885] Regression. Broken support for multi size measurements.
|
- [#885] Regression. Broken support for multi size measurements.
|
||||||
|
|
|
@ -273,6 +273,11 @@ bool VDomDocument::find(QHash<quint32, QDomElement> &cache, const QDomElement &n
|
||||||
{
|
{
|
||||||
const quint32 elementId = GetParametrUInt(node, AttrId, NULL_ID_STR);
|
const quint32 elementId = GetParametrUInt(node, AttrId, NULL_ID_STR);
|
||||||
|
|
||||||
|
if (cache.contains(elementId))
|
||||||
|
{
|
||||||
|
qWarning() << tr("Not unique id (%1)").arg(elementId);
|
||||||
|
}
|
||||||
|
|
||||||
cache.insert(elementId, node);
|
cache.insert(elementId, node);
|
||||||
if (elementId == id)
|
if (elementId == id)
|
||||||
{
|
{
|
||||||
|
@ -597,7 +602,7 @@ void VDomDocument::CollectId(const QDomElement &node, QVector<quint32> &vector)
|
||||||
const quint32 id = GetParametrId(node);
|
const quint32 id = GetParametrId(node);
|
||||||
if (vector.contains(id))
|
if (vector.contains(id))
|
||||||
{
|
{
|
||||||
throw VExceptionWrongId(QString("This id (%1) is not unique.").arg(id), node);
|
throw VExceptionWrongId(tr("This id (%1) is not unique.").arg(id), node);
|
||||||
}
|
}
|
||||||
vector.append(id);
|
vector.append(id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
#include "../ifc/ifcdef.h"
|
#include "../ifc/ifcdef.h"
|
||||||
#include "../ifc/xml/vdomdocument.h"
|
#include "../ifc/xml/vdomdocument.h"
|
||||||
#include "../ifc/xml/vabstractpattern.h"
|
#include "../ifc/xml/vabstractpattern.h"
|
||||||
|
#include "../ifc/exception/vexceptionwrongid.h"
|
||||||
#include "../../undocommands/addtocalc.h"
|
#include "../../undocommands/addtocalc.h"
|
||||||
#include "../../undocommands/savetooloptions.h"
|
#include "../../undocommands/savetooloptions.h"
|
||||||
#include "../qmuparser/qmuparsererror.h"
|
#include "../qmuparser/qmuparsererror.h"
|
||||||
|
@ -229,6 +230,12 @@ void VDrawTool::ChangeLabelVisibility(quint32 id, bool visible)
|
||||||
*/
|
*/
|
||||||
void VDrawTool::AddToCalculation(const QDomElement &domElement)
|
void VDrawTool::AddToCalculation(const QDomElement &domElement)
|
||||||
{
|
{
|
||||||
|
const QDomElement duplicate = doc->elementById(m_id);
|
||||||
|
if (not duplicate.isNull())
|
||||||
|
{
|
||||||
|
throw VExceptionWrongId(tr("This id (%1) is not unique.").arg(m_id), duplicate);
|
||||||
|
}
|
||||||
|
|
||||||
AddToCalc *addToCal = new AddToCalc(domElement, doc);
|
AddToCalc *addToCal = new AddToCalc(domElement, doc);
|
||||||
connect(addToCal, &AddToCalc::NeedFullParsing, doc, &VAbstractPattern::NeedFullParsing);
|
connect(addToCal, &AddToCalc::NeedFullParsing, doc, &VAbstractPattern::NeedFullParsing);
|
||||||
qApp->getUndoStack()->push(addToCal);
|
qApp->getUndoStack()->push(addToCal);
|
||||||
|
|
|
@ -37,6 +37,7 @@
|
||||||
|
|
||||||
#include "../ifc/ifcdef.h"
|
#include "../ifc/ifcdef.h"
|
||||||
#include "../ifc/xml/vabstractpattern.h"
|
#include "../ifc/xml/vabstractpattern.h"
|
||||||
|
#include "../ifc/exception/vexceptionwrongid.h"
|
||||||
#include "../vgeometry/vgobject.h"
|
#include "../vgeometry/vgobject.h"
|
||||||
#include "../vmisc/vabstractapplication.h"
|
#include "../vmisc/vabstractapplication.h"
|
||||||
#include "../vmisc/def.h"
|
#include "../vmisc/def.h"
|
||||||
|
@ -175,6 +176,12 @@ void VAbstractNode::ToolCreation(const Source &typeCreation)
|
||||||
*/
|
*/
|
||||||
void VAbstractNode::AddToModeling(const QDomElement &domElement)
|
void VAbstractNode::AddToModeling(const QDomElement &domElement)
|
||||||
{
|
{
|
||||||
|
const QDomElement duplicate = doc->elementById(m_id);
|
||||||
|
if (not duplicate.isNull())
|
||||||
|
{
|
||||||
|
throw VExceptionWrongId(tr("This id (%1) is not unique.").arg(m_id), duplicate);
|
||||||
|
}
|
||||||
|
|
||||||
QDomElement modeling;
|
QDomElement modeling;
|
||||||
if (m_drawName.isEmpty())
|
if (m_drawName.isEmpty())
|
||||||
{
|
{
|
||||||
|
|
|
@ -69,6 +69,7 @@ VToolPin *VToolPin::Create(VToolPinInitData initData)
|
||||||
catch (const VExceptionBadId &e)
|
catch (const VExceptionBadId &e)
|
||||||
{ // Possible case. Parent was deleted, but the node object is still here.
|
{ // Possible case. Parent was deleted, but the node object is still here.
|
||||||
Q_UNUSED(e)
|
Q_UNUSED(e)
|
||||||
|
initData.data->UpdateId(initData.id);
|
||||||
return nullptr;// Just ignore
|
return nullptr;// Just ignore
|
||||||
}
|
}
|
||||||
VPointF *pinPoint = new VPointF(*point);
|
VPointF *pinPoint = new VPointF(*point);
|
||||||
|
|
|
@ -97,6 +97,7 @@ VToolPlaceLabel *VToolPlaceLabel::Create(VToolPlaceLabelInitData &initData)
|
||||||
catch (const VExceptionBadId &e)
|
catch (const VExceptionBadId &e)
|
||||||
{ // Possible case. Parent was deleted, but the node object is still here.
|
{ // Possible case. Parent was deleted, but the node object is still here.
|
||||||
Q_UNUSED(e)
|
Q_UNUSED(e)
|
||||||
|
initData.data->UpdateId(initData.id);
|
||||||
return nullptr;// Just ignore
|
return nullptr;// Just ignore
|
||||||
}
|
}
|
||||||
node->setName(point->name());
|
node->setName(point->name());
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
#include "../vgeometry/vsplinepath.h"
|
#include "../vgeometry/vsplinepath.h"
|
||||||
#include "../vgeometry/vplacelabelitem.h"
|
#include "../vgeometry/vplacelabelitem.h"
|
||||||
#include "../ifc/xml/vpatternconverter.h"
|
#include "../ifc/xml/vpatternconverter.h"
|
||||||
|
#include "../ifc/exception/vexceptionwrongid.h"
|
||||||
#include "../undocommands/addpiece.h"
|
#include "../undocommands/addpiece.h"
|
||||||
#include "../undocommands/deletepiece.h"
|
#include "../undocommands/deletepiece.h"
|
||||||
#include "../undocommands/movepiece.h"
|
#include "../undocommands/movepiece.h"
|
||||||
|
@ -961,6 +962,12 @@ void VToolSeamAllowance::FullUpdateFromGuiApply()
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolSeamAllowance::AddToFile()
|
void VToolSeamAllowance::AddToFile()
|
||||||
{
|
{
|
||||||
|
const QDomElement duplicate = doc->elementById(m_id);
|
||||||
|
if (not duplicate.isNull())
|
||||||
|
{
|
||||||
|
throw VExceptionWrongId(tr("This id (%1) is not unique.").arg(m_id), duplicate);
|
||||||
|
}
|
||||||
|
|
||||||
const VPiece piece = VAbstractTool::data.GetPiece(m_id);
|
const VPiece piece = VAbstractTool::data.GetPiece(m_id);
|
||||||
|
|
||||||
QDomElement domElement = doc->createElement(getTagName());
|
QDomElement domElement = doc->createElement(getTagName());
|
||||||
|
|
|
@ -45,6 +45,7 @@
|
||||||
#include "../ifc/xml/vabstractconverter.h"
|
#include "../ifc/xml/vabstractconverter.h"
|
||||||
#include "../ifc/xml/vdomdocument.h"
|
#include "../ifc/xml/vdomdocument.h"
|
||||||
#include "../ifc/xml/vpatternconverter.h"
|
#include "../ifc/xml/vpatternconverter.h"
|
||||||
|
#include "../ifc/exception/vexceptionwrongid.h"
|
||||||
#include "../vgeometry/varc.h"
|
#include "../vgeometry/varc.h"
|
||||||
#include "../vgeometry/vellipticalarc.h"
|
#include "../vgeometry/vellipticalarc.h"
|
||||||
#include "../vgeometry/vsplinepath.h"
|
#include "../vgeometry/vsplinepath.h"
|
||||||
|
@ -1835,6 +1836,12 @@ void VToolUnionDetails::AddDetail(QDomElement &domElement, const VPiece &d) cons
|
||||||
*/
|
*/
|
||||||
void VToolUnionDetails::AddToModeling(const QDomElement &domElement)
|
void VToolUnionDetails::AddToModeling(const QDomElement &domElement)
|
||||||
{
|
{
|
||||||
|
const QDomElement duplicate = doc->elementById(m_id);
|
||||||
|
if (not duplicate.isNull())
|
||||||
|
{
|
||||||
|
throw VExceptionWrongId(tr("This id (%1) is not unique.").arg(m_id), duplicate);
|
||||||
|
}
|
||||||
|
|
||||||
const QString drawName = DrawName(doc, d1id, d2id);
|
const QString drawName = DrawName(doc, d1id, d2id);
|
||||||
SCASSERT(not drawName.isEmpty())
|
SCASSERT(not drawName.isEmpty())
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user