From 9d5fd45a38bb038e90ece0fc599024420c8e909a Mon Sep 17 00:00:00 2001 From: nds Date: Wed, 20 May 2015 16:28:21 +0300 Subject: [PATCH] A fix for the "Abort" operation bug. If a control with a validator is active, abort of the operation leads to the crash in the validator. Scenario: create a sketch, start creation of an extrusion, select a sketch, select an orthogonal plane, abort(selector is active). Crash --- src/ModuleBase/ModuleBase_IPropertyPanel.h | 3 +++ src/ModuleBase/ModuleBase_Operation.cpp | 3 +++ src/XGUI/XGUI_PropertyPanel.h | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/ModuleBase/ModuleBase_IPropertyPanel.h b/src/ModuleBase/ModuleBase_IPropertyPanel.h index fe8a110e0..3a18c858b 100644 --- a/src/ModuleBase/ModuleBase_IPropertyPanel.h +++ b/src/ModuleBase/ModuleBase_IPropertyPanel.h @@ -35,6 +35,9 @@ public: /// Returns all property panel's widget created by WidgetFactory virtual const QList& modelWidgets() const = 0; + /// Removes all widgets in the widget area of the property panel + virtual void cleanContent() = 0; + /// Editing mode depends on mode of current operation. This value is defined by it. /// \param isEditing state of editing mode flag virtual void setEditingMode(bool isEditing) { myIsEditing = isEditing; } diff --git a/src/ModuleBase/ModuleBase_Operation.cpp b/src/ModuleBase/ModuleBase_Operation.cpp index d877fa3ab..ae623079c 100644 --- a/src/ModuleBase/ModuleBase_Operation.cpp +++ b/src/ModuleBase/ModuleBase_Operation.cpp @@ -189,6 +189,9 @@ void ModuleBase_Operation::abort() emit aborted(); stopOperation(); + // is is necessary to deactivate current widgets before the model operation is aborted + // because abort removes the feature and activated filters should not check it + propertyPanel()->cleanContent(); ModelAPI_Session::get()->abortOperation(); emit stopped(); diff --git a/src/XGUI/XGUI_PropertyPanel.h b/src/XGUI/XGUI_PropertyPanel.h index cc9ba8aeb..bc0934af5 100644 --- a/src/XGUI/XGUI_PropertyPanel.h +++ b/src/XGUI/XGUI_PropertyPanel.h @@ -62,7 +62,7 @@ Q_OBJECT virtual const QList& modelWidgets() const; /// Removes all widgets in the widget area of the property panel - void cleanContent(); + virtual void cleanContent(); /// Returns currently active widget virtual ModuleBase_ModelWidget* activeWidget() const { return myActiveWidget; } -- 2.39.2