issue #0002836: Crash in sketcher
This commit is contained in:
parent
43e8c21743
commit
8a100bf627
|
@ -220,7 +220,11 @@ TaskBoxPrimitives::TaskBoxPrimitives(ViewProviderPrimitive* vp, QWidget* parent)
|
|||
if(i != index)
|
||||
ui.widgetStack->widget(i)->setSizePolicy(QSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored));
|
||||
}
|
||||
|
||||
|
||||
Gui::Document* doc = vp->getDocument();
|
||||
this->attachDocument(doc);
|
||||
this->enableNotifications(DocumentObserver::Delete);
|
||||
|
||||
//show the parts coordinate system axis for selection
|
||||
PartDesign::Body * body = PartDesign::Body::findBodyOf(vp->getObject());
|
||||
if(body) {
|
||||
|
@ -241,8 +245,8 @@ TaskBoxPrimitives::TaskBoxPrimitives(ViewProviderPrimitive* vp, QWidget* parent)
|
|||
TaskBoxPrimitives::~TaskBoxPrimitives()
|
||||
{
|
||||
//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();
|
||||
Gui::ViewProviderOrigin* vpOrigin;
|
||||
|
@ -254,6 +258,12 @@ TaskBoxPrimitives::~TaskBoxPrimitives()
|
|||
}
|
||||
}
|
||||
|
||||
void TaskBoxPrimitives::slotDeletedObject(const Gui::ViewProviderDocumentObject& Obj)
|
||||
{
|
||||
if (this->vp == &Obj)
|
||||
this->vp = nullptr;
|
||||
}
|
||||
|
||||
void TaskBoxPrimitives::onBoxHeightChanged(double v) {
|
||||
PartDesign::Box* box = static_cast<PartDesign::Box*>(vp->getObject());
|
||||
box->Height.setValue(v);
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
#include <Gui/TaskView/TaskView.h>
|
||||
#include <Gui/Selection.h>
|
||||
#include <Gui/DocumentObserver.h>
|
||||
#include <Gui/TaskView/TaskDialog.h>
|
||||
|
||||
#include "TaskSketchBasedParameters.h"
|
||||
|
@ -49,7 +50,8 @@ namespace PartDesignGui {
|
|||
|
||||
namespace s = boost::signals;
|
||||
|
||||
class TaskBoxPrimitives : public Gui::TaskView::TaskBox
|
||||
class TaskBoxPrimitives : public Gui::TaskView::TaskBox,
|
||||
public Gui::DocumentObserver
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -98,7 +100,11 @@ public Q_SLOTS:
|
|||
void onWedgeX2inChanged(double);
|
||||
void onWedgeZ2maxChanged(double);
|
||||
void onWedgeZ2inChanged(double);
|
||||
|
||||
|
||||
private:
|
||||
/** Notifies when the object is about to be removed. */
|
||||
virtual void slotDeletedObject(const Gui::ViewProviderDocumentObject& Obj);
|
||||
|
||||
private:
|
||||
QWidget* proxy;
|
||||
Ui_DlgPrimitives ui;
|
||||
|
|
Loading…
Reference in New Issue
Block a user