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