Fix crashing after a piece remove while rendering label.
This commit is contained in:
parent
7f3d06c383
commit
fea9e5ed07
|
@ -1346,6 +1346,16 @@ auto VToolSeamAllowance::shape() const -> QPainterPath
|
||||||
return ItemShapeFromPath(m_mainPath, pen());
|
return ItemShapeFromPath(m_mainPath, pen());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
|
void VToolSeamAllowance::CancelLabelRendering()
|
||||||
|
{
|
||||||
|
m_patternUpdateInfoWatcher->cancel();
|
||||||
|
m_pieceUpdateInfoWatcher->cancel();
|
||||||
|
|
||||||
|
m_patternUpdateInfoWatcher->waitForFinished();
|
||||||
|
m_pieceUpdateInfoWatcher->waitForFinished();
|
||||||
|
}
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
void VToolSeamAllowance::FullUpdateFromGuiApply()
|
void VToolSeamAllowance::FullUpdateFromGuiApply()
|
||||||
{
|
{
|
||||||
|
|
|
@ -121,6 +121,8 @@ public:
|
||||||
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
void paint(QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget) override;
|
||||||
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;
|
||||||
|
|
|
@ -75,6 +75,7 @@ void AddPiece::undo()
|
||||||
SCASSERT(not m_tool.isNull());
|
SCASSERT(not m_tool.isNull());
|
||||||
m_tool->DisconnectOutsideSignals();
|
m_tool->DisconnectOutsideSignals();
|
||||||
m_tool->hide();
|
m_tool->hide();
|
||||||
|
m_tool->CancelLabelRendering();
|
||||||
|
|
||||||
m_scene->removeItem(m_tool);
|
m_scene->removeItem(m_tool);
|
||||||
|
|
||||||
|
|
|
@ -34,24 +34,24 @@
|
||||||
#include "../ifc/ifcdef.h"
|
#include "../ifc/ifcdef.h"
|
||||||
#include "../ifc/xml/vabstractpattern.h"
|
#include "../ifc/xml/vabstractpattern.h"
|
||||||
#include "../ifc/xml/vdomdocument.h"
|
#include "../ifc/xml/vdomdocument.h"
|
||||||
#include "../vmisc/def.h"
|
|
||||||
#include "../tools/vdatatool.h"
|
#include "../tools/vdatatool.h"
|
||||||
#include "vundocommand.h"
|
#include "../vmisc/def.h"
|
||||||
#include "../vpatterndb/vpiecenode.h"
|
#include "../vpatterndb/vpiecenode.h"
|
||||||
#include "../vpatterndb/vpiecepath.h"
|
#include "../vpatterndb/vpiecepath.h"
|
||||||
#include "../vwidgets/vmaingraphicsview.h"
|
#include "../vwidgets/vmaingraphicsview.h"
|
||||||
|
#include "vundocommand.h"
|
||||||
|
|
||||||
//---------------------------------------------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------------------------------------------
|
||||||
DeletePiece::DeletePiece(VAbstractPattern *doc, quint32 id, const VContainer &data, VMainGraphicsScene *scene,
|
DeletePiece::DeletePiece(VAbstractPattern *doc, quint32 id, const VContainer &data, VMainGraphicsScene *scene,
|
||||||
QUndoCommand *parent)
|
QUndoCommand *parent)
|
||||||
: VUndoCommand(QDomElement(), doc, parent),
|
: VUndoCommand(QDomElement(), doc, parent),
|
||||||
m_parentNode(),
|
m_parentNode(),
|
||||||
m_siblingId(NULL_ID),
|
m_siblingId(NULL_ID),
|
||||||
m_detail(data.GetPiece(id)),
|
m_detail(data.GetPiece(id)),
|
||||||
m_data(data),
|
m_data(data),
|
||||||
m_scene(scene),
|
m_scene(scene),
|
||||||
m_tool(),
|
m_tool(),
|
||||||
m_record(VAbstractTool::GetRecord(id, Tool::Piece, doc))
|
m_record(VAbstractTool::GetRecord(id, Tool::Piece, doc))
|
||||||
{
|
{
|
||||||
setText(tr("delete tool"));
|
setText(tr("delete tool"));
|
||||||
nodeId = id;
|
nodeId = id;
|
||||||
|
@ -117,11 +117,12 @@ void DeletePiece::redo()
|
||||||
{
|
{
|
||||||
m_parentNode.removeChild(domElement);
|
m_parentNode.removeChild(domElement);
|
||||||
|
|
||||||
m_tool = qobject_cast<VToolSeamAllowance*>(VAbstractPattern::getTool(nodeId));
|
m_tool = qobject_cast<VToolSeamAllowance *>(VAbstractPattern::getTool(nodeId));
|
||||||
SCASSERT(not m_tool.isNull());
|
SCASSERT(not m_tool.isNull());
|
||||||
m_tool->DisconnectOutsideSignals();
|
m_tool->DisconnectOutsideSignals();
|
||||||
m_tool->EnableToolMove(true);
|
m_tool->EnableToolMove(true);
|
||||||
m_tool->hide();
|
m_tool->hide();
|
||||||
|
m_tool->CancelLabelRendering();
|
||||||
|
|
||||||
m_scene->removeItem(m_tool);
|
m_scene->removeItem(m_tool);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user