fix crash when cancelling revolution task panel
This commit is contained in:
parent
8a100bf627
commit
294b2308d6
|
@ -45,7 +45,17 @@ TaskFeatureParameters::TaskFeatureParameters(PartDesignGui::ViewProvider *vp, QW
|
|||
const std::string& pixmapname, const QString& parname)
|
||||
: TaskBox(Gui::BitmapFactory().pixmap(pixmapname.c_str()),parname,true, parent),
|
||||
vp(vp), blockUpdate(false)
|
||||
{ }
|
||||
{
|
||||
Gui::Document* doc = vp->getDocument();
|
||||
this->attachDocument(doc);
|
||||
this->enableNotifications(DocumentObserver::Delete);
|
||||
}
|
||||
|
||||
void TaskFeatureParameters::slotDeletedObject(const Gui::ViewProviderDocumentObject& Obj)
|
||||
{
|
||||
if (this->vp == &Obj)
|
||||
this->vp = nullptr;
|
||||
}
|
||||
|
||||
void TaskFeatureParameters::onUpdateView(bool on)
|
||||
{
|
||||
|
|
|
@ -26,25 +26,27 @@
|
|||
|
||||
#include <Gui/TaskView/TaskView.h>
|
||||
#include <Gui/TaskView/TaskDialog.h>
|
||||
#include <Gui/DocumentObserver.h>
|
||||
|
||||
#include "ViewProvider.h"
|
||||
|
||||
namespace PartDesignGui {
|
||||
|
||||
/// Convenience class to collect common methods for all SketchBased features
|
||||
class TaskFeatureParameters : public Gui::TaskView::TaskBox
|
||||
class TaskFeatureParameters : public Gui::TaskView::TaskBox,
|
||||
public Gui::DocumentObserver
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
TaskFeatureParameters(PartDesignGui::ViewProvider* vp, QWidget *parent,
|
||||
const std::string& pixmapname, const QString& parname);
|
||||
virtual ~TaskFeatureParameters() {};
|
||||
virtual ~TaskFeatureParameters() {}
|
||||
|
||||
/// save field history
|
||||
virtual void saveHistory(void) {};
|
||||
virtual void saveHistory(void) {}
|
||||
/// apply changes made in the parameters input to the model via commands
|
||||
virtual void apply() {};
|
||||
virtual void apply() {}
|
||||
|
||||
void recomputeFeature();
|
||||
|
||||
|
@ -52,6 +54,10 @@ protected Q_SLOTS:
|
|||
// TODO Add update view to all dialogs (2015-12-05, Fat-Zer)
|
||||
void onUpdateView(bool on);
|
||||
|
||||
private:
|
||||
/** Notifies when the object is about to be removed. */
|
||||
virtual void slotDeletedObject(const Gui::ViewProviderDocumentObject& Obj);
|
||||
|
||||
protected:
|
||||
PartDesignGui::ViewProvider *vp;
|
||||
/// Lock updateUI(), applying changes to the underlying feature and calling recomputeFeature()
|
||||
|
|
|
@ -361,8 +361,8 @@ bool TaskRevolutionParameters::getReversed(void) const
|
|||
TaskRevolutionParameters::~TaskRevolutionParameters()
|
||||
{
|
||||
//hide the parts coordinate system axis for selection
|
||||
PartDesign::Body * body = PartDesign::Body::findBodyOf ( vp->getObject() );
|
||||
if ( body ) {
|
||||
PartDesign::Body * body = vp ? PartDesign::Body::findBodyOf(vp->getObject()) : 0;
|
||||
if (body) {
|
||||
try {
|
||||
App::Origin *origin = body->getOrigin();
|
||||
ViewProviderOrigin* vpOrigin;
|
||||
|
@ -375,7 +375,7 @@ TaskRevolutionParameters::~TaskRevolutionParameters()
|
|||
|
||||
delete ui;
|
||||
|
||||
for(size_t i = 0 ; i < axesInList.size() ; i++ ){
|
||||
for (size_t i = 0; i < axesInList.size(); i++) {
|
||||
delete axesInList[i];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user