Fixed Valentina crash after undo deleting detail.

Emitting signal in lambda was not really good idea.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2016-07-19 20:50:42 +03:00
parent 8b438daa6c
commit fc7e0bb6cb
6 changed files with 21 additions and 7 deletions

View File

@ -1052,6 +1052,18 @@ void VAbstractPattern::haveLiteChange()
emit patternChanged(false); emit patternChanged(false);
} }
//---------------------------------------------------------------------------------------------------------------------
void VAbstractPattern::NeedFullParsing()
{
emit UndoCommand();
}
//---------------------------------------------------------------------------------------------------------------------
void VAbstractPattern::ClearScene()
{
emit ClearMainWindow();
}
//--------------------------------------------------------------------------------------------------------------------- //---------------------------------------------------------------------------------------------------------------------
void VAbstractPattern::ToolExists(const quint32 &id) const void VAbstractPattern::ToolExists(const quint32 &id) const
{ {

View File

@ -253,6 +253,8 @@ signals:
public slots: public slots:
virtual void LiteParseTree(const Document &parse)=0; virtual void LiteParseTree(const Document &parse)=0;
void haveLiteChange(); void haveLiteChange();
void NeedFullParsing();
void ClearScene();
protected: protected:
/** @brief nameActivDraw name current pattern peace. */ /** @brief nameActivDraw name current pattern peace. */

View File

@ -143,8 +143,8 @@ void VToolBasePoint::AddToFile()
patternPiece.appendChild(doc->createElement(VAbstractPattern::TagDetails)); patternPiece.appendChild(doc->createElement(VAbstractPattern::TagDetails));
AddPatternPiece *addPP = new AddPatternPiece(patternPiece, doc, namePP); AddPatternPiece *addPP = new AddPatternPiece(patternPiece, doc, namePP);
connect(addPP, &AddPatternPiece::ClearScene, [this](){emit doc->ClearMainWindow();}); connect(addPP, &AddPatternPiece::ClearScene, doc, &VAbstractPattern::ClearScene);
connect(addPP, &AddPatternPiece::NeedFullParsing, [this](){emit doc->UndoCommand();}); connect(addPP, &AddPatternPiece::NeedFullParsing, doc, &VAbstractPattern::NeedFullParsing);
qApp->getUndoStack()->push(addPP); qApp->getUndoStack()->push(addPP);
} }
@ -233,7 +233,7 @@ void VToolBasePoint::DeleteTool(bool ask)
qCDebug(vTool, "Begin deleting."); qCDebug(vTool, "Begin deleting.");
DeletePatternPiece *deletePP = new DeletePatternPiece(doc, nameActivDraw); DeletePatternPiece *deletePP = new DeletePatternPiece(doc, nameActivDraw);
connect(deletePP, &DeletePatternPiece::NeedFullParsing, [this](){emit doc->UndoCommand();}); connect(deletePP, &DeletePatternPiece::NeedFullParsing, doc, &VAbstractPattern::NeedFullParsing);
qApp->getUndoStack()->push(deletePP); qApp->getUndoStack()->push(deletePP);
// Throw exception, this will help prevent case when we forget to immediately quit function. // Throw exception, this will help prevent case when we forget to immediately quit function.

View File

@ -372,7 +372,7 @@ qreal VDrawTool::CheckFormula(const quint32 &toolId, QString &formula, VContaine
void VDrawTool::AddToCalculation(const QDomElement &domElement) void VDrawTool::AddToCalculation(const QDomElement &domElement)
{ {
AddToCalc *addToCal = new AddToCalc(domElement, doc); AddToCalc *addToCal = new AddToCalc(domElement, doc);
connect(addToCal, &AddToCalc::NeedFullParsing, [this](){emit doc->UndoCommand();}); connect(addToCal, &AddToCalc::NeedFullParsing, doc, &VAbstractPattern::NeedFullParsing);
qApp->getUndoStack()->push(addToCal); qApp->getUndoStack()->push(addToCal);
} }

View File

@ -88,7 +88,7 @@ void VAbstractTool::DeleteTool(bool ask)
qCDebug(vTool, "Begin deleting."); qCDebug(vTool, "Begin deleting.");
DelTool *delTool = new DelTool(doc, id); DelTool *delTool = new DelTool(doc, id);
connect(delTool, &DelTool::NeedFullParsing, [this](){emit doc->UndoCommand();}); connect(delTool, &DelTool::NeedFullParsing, doc, &VAbstractPattern::NeedFullParsing);
qApp->getUndoStack()->push(delTool); qApp->getUndoStack()->push(delTool);
// Throw exception, this will help prevent case when we forget to immediately quit function. // Throw exception, this will help prevent case when we forget to immediately quit function.

View File

@ -331,7 +331,7 @@ void VToolDetail::AddToFile()
} }
AddDet *addDet = new AddDet(domElement, doc, detail, drawName); AddDet *addDet = new AddDet(domElement, doc, detail, drawName);
connect(addDet, &AddDet::NeedFullParsing, [this](){emit doc->UndoCommand();}); connect(addDet, &AddDet::NeedFullParsing, doc, &VAbstractPattern::NeedFullParsing);
qApp->getUndoStack()->push(addDet); qApp->getUndoStack()->push(addDet);
} }
@ -680,7 +680,7 @@ void VToolDetail::DeleteTool(bool ask)
return; return;
} }
/* If UnionDetails tool delete detail no need emit FullParsing.*/ /* If UnionDetails tool delete detail no need emit FullParsing.*/
connect(delDet, &DeleteDetail::NeedFullParsing, [this](){emit doc->UndoCommand();}); connect(delDet, &DeleteDetail::NeedFullParsing, doc, &VAbstractPattern::NeedFullParsing);
} }
qApp->getUndoStack()->push(delDet); qApp->getUndoStack()->push(delDet);