Fix crashing after a piece remove while rendering label.
This commit is contained in:
parent
fea9e5ed07
commit
28e70e73c6
|
@ -4512,6 +4512,9 @@ void VPattern::PrepareForParse(const Document &parse)
|
|||
{
|
||||
SCASSERT(sceneDraw != nullptr)
|
||||
SCASSERT(sceneDetail != nullptr)
|
||||
|
||||
emit CancelLabelRendering();
|
||||
|
||||
if (parse == Document::FullParse)
|
||||
{
|
||||
RefreshElementIdCache();
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
#define VPATTERN_H
|
||||
|
||||
#include "../ifc/xml/vabstractpattern.h"
|
||||
#include "../vpatterndb/vcontainer.h"
|
||||
#include "../ifc/xml/vpatternconverter.h"
|
||||
#include "../vpatterndb/vcontainer.h"
|
||||
|
||||
class VMainGraphicsScene;
|
||||
class VNodeDetail;
|
||||
|
@ -45,6 +45,7 @@ class VToolSeamAllowance;
|
|||
class VPattern : public VAbstractPattern
|
||||
{
|
||||
Q_OBJECT // NOLINT
|
||||
|
||||
public:
|
||||
VPattern(VContainer *data, VMainGraphicsScene *sceneDraw, VMainGraphicsScene *sceneDetail,
|
||||
QObject *parent = nullptr);
|
||||
|
@ -144,8 +145,8 @@ private:
|
|||
static auto ParseDetailNode(const QDomElement &domElement) -> VNodeDetail;
|
||||
|
||||
void ParseRootElement(const Document &parse, const QDomNode &node);
|
||||
void ParseDrawElement(const QDomNode& node, const Document &parse);
|
||||
void ParseDrawMode(const QDomNode& node, const Document &parse, const Draw &mode);
|
||||
void ParseDrawElement(const QDomNode &node, const Document &parse);
|
||||
void ParseDrawMode(const QDomNode &node, const Document &parse, const Draw &mode);
|
||||
void ParseDrawModeElement(QDomElement &domElement, const Document &parse, const Draw &mode);
|
||||
void ParseDetailElement(QDomElement &domElement, const Document &parse);
|
||||
void ParseDetailInternals(const QDomElement &domElement, VPiece &detail) const;
|
||||
|
@ -205,23 +206,20 @@ private:
|
|||
const Document &parse);
|
||||
void ParseToolPointOfIntersectionCircles(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
||||
void ParseToolPointOfIntersectionCurves(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
||||
void ParseToolPointFromCircleAndTangent(VMainGraphicsScene *scene, QDomElement &domElement,
|
||||
const Document &parse);
|
||||
void ParseToolPointFromCircleAndTangent(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
||||
void ParseToolPointFromArcAndTangent(VMainGraphicsScene *scene, const QDomElement &domElement,
|
||||
const Document &parse);
|
||||
void ParseToolTrueDarts(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse);
|
||||
|
||||
// TODO. Delete if minimal supported version is 0.2.7
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 7),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 7), "Time to refactor the code.");
|
||||
void ParseOldToolSpline(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
||||
|
||||
void ParseToolSpline(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
||||
void ParseToolCubicBezier(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse);
|
||||
|
||||
// TODO. Delete if minimal supported version is 0.2.7
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 7),
|
||||
"Time to refactor the code.");
|
||||
Q_STATIC_ASSERT_X(VPatternConverter::PatternMinVer < FormatVersion(0, 2, 7), "Time to refactor the code.");
|
||||
void ParseOldToolSplinePath(VMainGraphicsScene *scene, QDomElement &domElement, const Document &parse);
|
||||
|
||||
void ParseToolSplinePath(VMainGraphicsScene *scene, const QDomElement &domElement, const Document &parse);
|
||||
|
|
|
@ -473,6 +473,8 @@ signals:
|
|||
void BackgroundImagePositionChanged(const QUuid &id);
|
||||
void BackgroundImageOpacityChanged(const QUuid &id);
|
||||
|
||||
void CancelLabelRendering();
|
||||
|
||||
public slots:
|
||||
virtual void LiteParseTree(const Document &parse) = 0;
|
||||
void haveLiteChange();
|
||||
|
|
|
@ -395,6 +395,12 @@ auto RenderFoldLine(const VPiece &detail, const VContainer *data) -> VFoldLine
|
|||
}
|
||||
} // namespace
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
VToolSeamAllowance::~VToolSeamAllowance()
|
||||
{
|
||||
CancelLabelRendering();
|
||||
}
|
||||
|
||||
//---------------------------------------------------------------------------------------------------------------------
|
||||
auto VToolSeamAllowance::Create(const QPointer<DialogTool> &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
|
||||
VContainer *data) -> VToolSeamAllowance *
|
||||
|
@ -1734,6 +1740,7 @@ VToolSeamAllowance::VToolSeamAllowance(const VToolSeamAllowanceInitData &initDat
|
|||
connect(m_sceneDetails, &VMainGraphicsScene::EnableToolMove, this, &VToolSeamAllowance::EnableToolMove);
|
||||
connect(m_sceneDetails, &VMainGraphicsScene::ItemSelection, this, &VToolSeamAllowance::ToolSelectionType);
|
||||
connect(m_sceneDetails, &VMainGraphicsScene::UpdatePassmarks, this, &VToolSeamAllowance::UpdatePassmarks);
|
||||
connect(doc, &VAbstractPattern::CancelLabelRendering, this, &VToolSeamAllowance::CancelLabelRendering);
|
||||
|
||||
ConnectOutsideSignals();
|
||||
|
||||
|
@ -1973,6 +1980,8 @@ void VToolSeamAllowance::SaveDialogChange(const QString &undoText)
|
|||
const VPiece newDet = dialogTool->GetPiece();
|
||||
const VPiece oldDet = VAbstractTool::data.GetPiece(m_id);
|
||||
|
||||
CancelLabelRendering();
|
||||
|
||||
QVector<QPointer<VUndoCommand>> &undocommands = dialogTool->UndoStack();
|
||||
const bool groupChange = not undocommands.isEmpty();
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ class VToolSeamAllowance final : public VInteractiveTool, public QGraphicsPathIt
|
|||
Q_OBJECT // NOLINT
|
||||
|
||||
public:
|
||||
~VToolSeamAllowance() override = default;
|
||||
~VToolSeamAllowance() override;
|
||||
|
||||
static auto Create(const QPointer<DialogTool> &dialog, VMainGraphicsScene *scene, VAbstractPattern *doc,
|
||||
VContainer *data) -> VToolSeamAllowance *;
|
||||
|
@ -122,7 +122,6 @@ public:
|
|||
auto boundingRect() const -> QRectF override;
|
||||
auto shape() const -> QPainterPath override;
|
||||
|
||||
void CancelLabelRendering();
|
||||
public slots:
|
||||
void FullUpdateFromGuiApply() override;
|
||||
void FullUpdateFromFile() override;
|
||||
|
@ -138,6 +137,8 @@ public slots:
|
|||
void UpdatePassmarks();
|
||||
void ShowOptions();
|
||||
void DeleteFromMenu();
|
||||
void CancelLabelRendering();
|
||||
|
||||
protected slots:
|
||||
void UpdateGrainline();
|
||||
void SaveMoveDetail(const QPointF &ptPos);
|
||||
|
|
Loading…
Reference in New Issue
Block a user