Fixed crash after undo creating a pattern piece.

--HG--
branch : develop
This commit is contained in:
Roman Telezhynskyi 2015-11-02 18:25:29 +02:00
parent 9aa8713203
commit 345b0e5c7f
37 changed files with 468 additions and 106 deletions

View File

@ -277,6 +277,13 @@ bool MApplication::notify(QObject *receiver, QEvent *event)
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
exit(V_EX_DATAERR);
}
catch (const VExceptionToolWasDeleted &e)
{
qCCritical(mApp, "%s\n\n%s\n\n%s",
qUtf8Printable("Unhadled deleting tool. Continue use object after deleting!"),
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
exit(V_EX_DATAERR);
}
catch (const VException &e)
{
qCCritical(mApp, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Something's wrong!!")),

View File

@ -335,6 +335,13 @@ bool VApplication::notify(QObject *receiver, QEvent *event)
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
exit(V_EX_DATAERR);
}
catch (const VExceptionToolWasDeleted &e)
{
qCCritical(vApp, "%s\n\n%s\n\n%s",
qUtf8Printable("Unhadled deleting tool. Continue use object after deleting"),
qUtf8Printable(e.ErrorMessage()), qUtf8Printable(e.DetailedInformation()));
exit(V_EX_DATAERR);
}
catch (const VException &e)
{
qCCritical(vApp, "%s\n\n%s\n\n%s", qUtf8Printable(tr("Something's wrong!!")),

View File

@ -42,7 +42,8 @@
* @brief VException constructor exception
* @param what string with error
*/
VException::VException(const QString &what):QException(), what(what), moreInfo(QString())
VException::VException(const QString &what) V_NOEXCEPT_EXPR (true)
:QException(), what(what), moreInfo(QString())
{
Q_ASSERT_X(not what.isEmpty(), Q_FUNC_INFO, "Error message is empty");
}
@ -135,3 +136,42 @@ Q_NORETURN void VException::raise() const
{
throw *this;
}
//-----------------------------------------VExceptionToolWasDeleted----------------------------------------------------
VExceptionToolWasDeleted::VExceptionToolWasDeleted(const QString &what) V_NOEXCEPT_EXPR (true)
:VException(what)
{
}
//---------------------------------------------------------------------------------------------------------------------
VExceptionToolWasDeleted::VExceptionToolWasDeleted(const VExceptionToolWasDeleted &e)
:VException(e)
{
}
//---------------------------------------------------------------------------------------------------------------------
VExceptionToolWasDeleted &VExceptionToolWasDeleted::operator=(const VExceptionToolWasDeleted &e)
{
if ( &e == this )
{
return *this;
}
VException::operator=(e);
return *this;
}
//---------------------------------------------------------------------------------------------------------------------
/**
* @brief raise method raise for exception
*/
// cppcheck-suppress unusedFunction
Q_NORETURN void VExceptionToolWasDeleted::VExceptionToolWasDeleted::raise() const
{
throw *this;
}
//---------------------------------------------------------------------------------------------------------------------
VExceptionToolWasDeleted *VExceptionToolWasDeleted::clone() const
{
return new VExceptionToolWasDeleted(*this);
}

View File

@ -34,8 +34,6 @@
#include <QCoreApplication>
#include "../ifcdef.h"
class QWidget;
/**
* @brief The VException class parent for all exception. Could be use for abstract exception
*/
@ -43,7 +41,7 @@ class VException : public QException
{
Q_DECLARE_TR_FUNCTIONS(VException)
public:
explicit VException(const QString &what);
explicit VException(const QString &what) V_NOEXCEPT_EXPR (true);
VException(const VException &e);
VException &operator=(const VException &e);
virtual ~VException() V_NOEXCEPT_EXPR (true) Q_DECL_OVERRIDE {}
@ -86,4 +84,19 @@ inline QString VException::MoreInformation() const
return moreInfo;
}
// Want have special exception for catching unhadled deleting a tool
class VExceptionToolWasDeleted : public VException
{
Q_DECLARE_TR_FUNCTIONS(VExceptionToolDeleted)
public:
explicit VExceptionToolWasDeleted(const QString &what) V_NOEXCEPT_EXPR (true);
VExceptionToolWasDeleted(const VExceptionToolWasDeleted &e);
VExceptionToolWasDeleted &operator=(const VExceptionToolWasDeleted &e);
virtual ~VExceptionToolWasDeleted() V_NOEXCEPT_EXPR (true) Q_DECL_OVERRIDE {}
Q_NORETURN virtual void raise() const Q_DECL_OVERRIDE;
// cppcheck-suppress unusedFunction
virtual VExceptionToolWasDeleted *clone() const Q_DECL_OVERRIDE;
};
#endif // VEXCEPTION_H

View File

@ -186,8 +186,16 @@ void VAbstractSpline::keyReleaseEvent(QKeyEvent *event)
switch (event->key())
{
case Qt::Key_Delete:
try
{
DeleteTool();
return; //Leave this method immediately after call!!!
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e);
return;//Leave this method immediately!!!
}
break;
default:
break;
}

View File

@ -293,7 +293,15 @@ void VToolArc::ShowVisualization(bool show)
*/
void VToolArc::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
try
{
ContextMenu<DialogArc>(this, event);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e);
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -255,7 +255,15 @@ void VToolArcWithLength::ShowVisualization(bool show)
//---------------------------------------------------------------------------------------------------------------------
void VToolArcWithLength::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
try
{
ContextMenu<DialogArcWithLength>(this, event);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e);
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -270,7 +270,15 @@ void VToolSpline::EnableToolMove(bool move)
*/
void VToolSpline::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
try
{
ContextMenu<DialogSpline>(this, event);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e);
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -317,7 +317,15 @@ void VToolSplinePath::ShowVisualization(bool show)
*/
void VToolSplinePath::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
try
{
ContextMenu<DialogSplinePath>(this, event);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e);
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -231,8 +231,16 @@ void VToolDoublePoint::keyReleaseEvent(QKeyEvent *event)
switch (event->key())
{
case Qt::Key_Delete:
try
{
DeleteTool();
return; //Leave this method immediately after call!!!
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e);
return;//Leave this method immediately!!!
}
break;
default:
break;
}

View File

@ -291,7 +291,15 @@ void VToolTrueDarts::SetDartP3Id(const quint32 &value)
//---------------------------------------------------------------------------------------------------------------------
void VToolTrueDarts::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
try
{
ContextMenu<DialogTrueDarts>(this, event);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e);
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -202,7 +202,15 @@ void VToolCutArc::CurveChoosed(quint32 id)
*/
void VToolCutArc::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
try
{
ContextMenu<DialogCutArc>(this, event);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e);
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -210,7 +210,15 @@ void VToolCutSpline::CurveChoosed(quint32 id)
*/
void VToolCutSpline::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
try
{
ContextMenu<DialogCutSpline>(this, event);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e);
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -254,7 +254,15 @@ void VToolCutSplinePath::CurveChoosed(quint32 id)
*/
void VToolCutSplinePath::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
try
{
ContextMenu<DialogCutSplinePath>(this, event);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e);
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -77,7 +77,15 @@ void VToolAlongLine::SetFactor(qreal factor)
//cppcheck-suppress unusedFunction
void VToolAlongLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
try
{
ContextMenu<DialogAlongLine>(this, event);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e);
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -231,7 +231,15 @@ void VToolBisector::SetFactor(qreal factor)
*/
void VToolBisector::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
try
{
ContextMenu<DialogBisector>(this, event);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e);
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -224,7 +224,15 @@ void VToolCurveIntersectAxis::ShowVisualization(bool show)
//---------------------------------------------------------------------------------------------------------------------
void VToolCurveIntersectAxis::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
try
{
ContextMenu<DialogCurveIntersectAxis>(this, event);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e);
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -183,7 +183,15 @@ VToolEndLine* VToolEndLine::Create(const quint32 _id, const QString &pointName,
*/
void VToolEndLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
try
{
ContextMenu<DialogEndLine>(this, event);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e);
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -189,7 +189,15 @@ QPointF VToolHeight::FindPoint(const QLineF &line, const QPointF &point)
*/
void VToolHeight::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
try
{
ContextMenu<DialogHeight>(this, event);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e);
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -235,7 +235,15 @@ void VToolLineIntersectAxis::ShowVisualization(bool show)
//---------------------------------------------------------------------------------------------------------------------
void VToolLineIntersectAxis::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
try
{
ContextMenu<DialogLineIntersectAxis>(this, event);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e);
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -209,7 +209,15 @@ void VToolNormal::SetFactor(qreal factor)
*/
void VToolNormal::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
try
{
ContextMenu<DialogNormal>(this, event);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e);
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -235,7 +235,15 @@ void VToolShoulderPoint::SetFactor(qreal factor)
*/
void VToolShoulderPoint::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
try
{
ContextMenu<DialogShoulderPoint>(this, event);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e);
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -180,6 +180,10 @@ void VToolBasePoint::DeleteTool(bool ask)
DeletePatternPiece *deletePP = new DeletePatternPiece(doc, nameActivDraw);
connect(deletePP, &DeletePatternPiece::NeedFullParsing, doc, &VAbstractPattern::NeedFullParsing);
qApp->getUndoStack()->push(deletePP);
// Throw exception, this will help prevent case when we forget to immediately quit function.
VExceptionToolWasDeleted e("Tool was used after deleting.");
throw e;
}
}
@ -291,17 +295,22 @@ void VToolBasePoint::contextMenuEvent ( QGraphicsSceneContextMenuEvent * event )
QApplication::restoreOverrideCursor();
#endif
quint32 ref = _referens; // store referens
_referens = 1; // make available delete pattern piece
try
{
if (doc->CountPP() > 1)
{
ContextMenu<DialogSinglePoint>(this, event);
ContextMenu<DialogSinglePoint>(this, event, RemoveOption::Enable, Referens::Ignore);
}
else
{
ContextMenu<DialogSinglePoint>(this, event, false);
ContextMenu<DialogSinglePoint>(this, event, RemoveOption::Disable);
}
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e);
return;//Leave this method immediately!!!
}
_referens = ref; // restore referens. If not restore garbage collector delete point!!!
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -197,7 +197,15 @@ void VToolLineIntersect::SetFactor(qreal factor)
*/
void VToolLineIntersect::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
try
{
ContextMenu<DialogLineIntersect>(this, event);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e);
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -267,7 +267,15 @@ void VToolPointFromArcAndTangent::RemoveReferens()
//---------------------------------------------------------------------------------------------------------------------
void VToolPointFromArcAndTangent::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
try
{
ContextMenu<DialogPointFromArcAndTangent>(this, event);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e);
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -251,7 +251,15 @@ void VToolPointFromCircleAndTangent::RemoveReferens()
//---------------------------------------------------------------------------------------------------------------------
void VToolPointFromCircleAndTangent::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
try
{
ContextMenu<DialogPointFromCircleAndTangent>(this, event);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e);
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -251,7 +251,15 @@ void VToolPointOfContact::SetFactor(qreal factor)
*/
void VToolPointOfContact::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
try
{
ContextMenu<DialogPointOfContact>(this, event);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e);
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -170,7 +170,15 @@ void VToolPointOfIntersection::RemoveReferens()
*/
void VToolPointOfIntersection::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
try
{
ContextMenu<DialogPointOfIntersection>(this, event);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e);
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -274,7 +274,15 @@ void VToolPointOfIntersectionArcs::RemoveReferens()
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionArcs::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
try
{
ContextMenu<DialogPointOfIntersectionArcs>(this, event);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e);
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -287,7 +287,15 @@ void VToolPointOfIntersectionCircles::RemoveReferens()
//---------------------------------------------------------------------------------------------------------------------
void VToolPointOfIntersectionCircles::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
try
{
ContextMenu<DialogPointOfIntersectionCircles>(this, event);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e);
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -310,8 +310,16 @@ void VToolSinglePoint::keyReleaseEvent(QKeyEvent *event)
switch (event->key())
{
case Qt::Key_Delete:
try
{
DeleteTool();
return; //Leave this method immediately after call!!!
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e);
return;//Leave this method immediately!!!
}
break;
default:
break;
}

View File

@ -226,7 +226,15 @@ void VToolTriangle::RemoveReferens()
*/
void VToolTriangle::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
try
{
ContextMenu<DialogTriangle>(this, event);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e);
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -60,7 +60,15 @@ void VAbstractPoint::ShowTool(quint32 id, bool enable)
//---------------------------------------------------------------------------------------------------------------------
void VAbstractPoint::DeleteFromLabel()
{
DeleteTool(); //Leave this method immediately after call!!!
try
{
DeleteTool();
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e);
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -74,6 +74,9 @@ public slots:
virtual void Disable(bool disable, const QString &namePP)=0;
protected:
enum class RemoveOption : bool {Disable = false, Enable = true};
enum class Referens : bool {Follow = true, Ignore = false};
/** @brief nameActivDraw name of tool's pattern peace. */
QString nameActivDraw;
@ -105,7 +108,9 @@ protected:
virtual void ReadToolAttributes(const QDomElement &domElement)=0;
template <typename Dialog, typename Tool>
void ContextMenu(Tool *tool, QGraphicsSceneContextMenuEvent *event, bool showRemove = true);
void ContextMenu(Tool *tool, QGraphicsSceneContextMenuEvent *event,
const RemoveOption &showRemove = RemoveOption::Enable,
const Referens &ref = Referens::Follow);
template <typename Item>
void ShowItem(Item *item, quint32 id, bool enable);
@ -119,9 +124,11 @@ template <typename Dialog, typename Tool>
* @brief ContextMenu show context menu for tool.
* @param tool tool.
* @param event context menu event.
* @param showRemove true - tool have option delete.
* @param showRemove true - tool enable option delete.
* @param ref true - do not ignore referens value.
*/
void VDrawTool::ContextMenu(Tool *tool, QGraphicsSceneContextMenuEvent *event, bool showRemove)
void VDrawTool::ContextMenu(Tool *tool, QGraphicsSceneContextMenuEvent *event, const RemoveOption &showRemove,
const Referens &ref)
{
SCASSERT(tool != nullptr);
SCASSERT(event != nullptr);
@ -129,7 +136,9 @@ void VDrawTool::ContextMenu(Tool *tool, QGraphicsSceneContextMenuEvent *event, b
QMenu menu;
QAction *actionOption = menu.addAction(QIcon::fromTheme("preferences-other"), tr("Options"));
QAction *actionRemove = menu.addAction(QIcon::fromTheme("edit-delete"), tr("Delete"));
if (showRemove)
if (showRemove == RemoveOption::Enable)
{
if (ref == Referens::Follow)
{
if (_referens > 1)
{
@ -141,6 +150,11 @@ void VDrawTool::ContextMenu(Tool *tool, QGraphicsSceneContextMenuEvent *event, b
}
}
else
{
actionRemove->setEnabled(true);
}
}
else
{
actionRemove->setEnabled(false);
}
@ -161,7 +175,7 @@ void VDrawTool::ContextMenu(Tool *tool, QGraphicsSceneContextMenuEvent *event, b
}
if (selectedAction == actionRemove)
{
DeleteTool();
DeleteTool(); // do not catch exception here
return; //Leave this method immediately after call!!!
}
}

View File

@ -231,7 +231,15 @@ void VToolLine::Disable(bool disable, const QString &namePP)
*/
void VToolLine::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
{
try
{
ContextMenu<DialogLine>(this, event);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e);
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------
@ -338,8 +346,16 @@ void VToolLine::keyReleaseEvent(QKeyEvent *event)
switch (event->key())
{
case Qt::Key_Delete:
try
{
DeleteTool();
return; //Leave this method immediately after call!!!
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e);
return;//Leave this method immediately!!!
}
break;
default:
break;
}

View File

@ -80,6 +80,10 @@ void VAbstractTool::DeleteTool(bool ask)
DelTool *delTool = new DelTool(doc, id);
connect(delTool, &DelTool::NeedFullParsing, doc, &VAbstractPattern::NeedFullParsing);
qApp->getUndoStack()->push(delTool);
// Throw exception, this will help prevent case when we forget to immediately quit function.
VExceptionToolWasDeleted e("Tool was used after deleting.");
throw e;
}
}

View File

@ -238,7 +238,15 @@ void VToolDetail::Create(const quint32 &_id, const VDetail &newDetail, VMainGrap
*/
void VToolDetail::Remove(bool ask)
{
try
{
DeleteTool(ask);
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e);
return;//Leave this method immediately!!!
}
}
//---------------------------------------------------------------------------------------------------------------------
@ -367,8 +375,16 @@ void VToolDetail::keyReleaseEvent(QKeyEvent *event)
switch (event->key())
{
case Qt::Key_Delete:
try
{
DeleteTool();
return; //Leave this method immediately after call!!!
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e);
return;//Leave this method immediately!!!
}
break;
default:
break;
}
@ -419,8 +435,16 @@ void VToolDetail::contextMenuEvent(QGraphicsSceneContextMenuEvent *event)
dialog->show();
}
if (selectedAction == actionRemove)
{
try
{
DeleteTool();
}
catch(const VExceptionToolWasDeleted &e)
{
Q_UNUSED(e);
return;//Leave this method immediately!!!
}
return; //Leave this method immediately after call!!!
}
}
@ -525,6 +549,10 @@ void VToolDetail::DeleteTool(bool ask)
connect(delDet, &DeleteDetail::NeedFullParsing, doc, &VAbstractPattern::NeedFullParsing);
}
qApp->getUndoStack()->push(delDet);
// Throw exception, this will help prevent case when we forget to immediately quit function.
VExceptionToolWasDeleted e("Tool was used after deleting.");
throw e;
}
//---------------------------------------------------------------------------------------------------------------------