Skip to content

Commit

Permalink
fix crash when pressing cancel on pipe task panel
Browse files Browse the repository at this point in the history
  • Loading branch information
wwmayer committed Jan 24, 2017
1 parent d9dda3f commit bebda4c
Showing 1 changed file with 38 additions and 33 deletions.
71 changes: 38 additions & 33 deletions src/Mod/PartDesign/Gui/TaskPipeParameters.cpp
Expand Up @@ -67,7 +67,7 @@ using namespace Gui;
// Task Parameter
//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

TaskPipeParameters::TaskPipeParameters(ViewProviderPipe *PipeView,bool /*newObj*/, QWidget *parent)
TaskPipeParameters::TaskPipeParameters(ViewProviderPipe *PipeView, bool /*newObj*/, QWidget *parent)
: TaskSketchBasedParameters(PipeView, parent, "PartDesign_Additive_Pipe",tr("Pipe parameters"))
{
// we need a separate container widget to add all controls to
Expand All @@ -84,15 +84,15 @@ TaskPipeParameters::TaskPipeParameters(ViewProviderPipe *PipeView,bool /*newObj*
this, SLOT(onButtonRefRemove(bool)));
connect(ui->buttonProfileBase, SIGNAL(toggled(bool)),
this, SLOT(onBaseButton(bool)));

this->groupLayout()->addWidget(proxy);

PartDesign::Pipe* pipe = static_cast<PartDesign::Pipe*>(PipeView->getObject());
Gui::Document* doc = Gui::Application::Instance->activeDocument();
//make sure th euser sees al important things: the
//spine/auxillery spine he already selected
if(pipe->Spine.getValue()) {
Gui::Document* doc = PipeView->getDocument();

//make sure the user sees all important things: the
//spine/auxilliary spine he already selected
if (pipe->Spine.getValue()) {
auto* svp = doc->getViewProvider(pipe->Spine.getValue());
spineShow = svp->isShow();
svp->setVisible(true);
Expand All @@ -104,9 +104,9 @@ TaskPipeParameters::TaskPipeParameters(ViewProviderPipe *PipeView,bool /*newObj*
std::vector<std::string> strings = pipe->Spine.getSubValues();
for (std::vector<std::string>::const_iterator i = strings.begin(); i != strings.end(); i++)
ui->listWidgetReferences->addItem(QString::fromStdString(*i));

ui->comboBoxTransition->setCurrentIndex(pipe->Transition.getValue());

updateUI();
}

Expand Down Expand Up @@ -151,18 +151,21 @@ void TaskPipeParameters::onSelectionChanged(const Gui::SelectionChanges& msg)

TaskPipeParameters::~TaskPipeParameters()
{
PartDesign::Pipe* pipe = static_cast<PartDesign::Pipe*>(vp->getObject());
Gui::Document* doc = Gui::Application::Instance->activeDocument();

//make sure th euser sees al important things: the
//spine/auxillery spine he already selected
if(pipe->Spine.getValue()) {
auto* svp = doc->getViewProvider(pipe->Spine.getValue());
svp->setVisible(spineShow);
spineShow = false;
if (vp) {
PartDesign::Pipe* pipe = static_cast<PartDesign::Pipe*>(vp->getObject());
Gui::Document* doc = vp->getDocument();

//make sure the user sees all important things: the
//spine/auxilliary spine he already selected
if (pipe->Spine.getValue()) {
auto* svp = doc->getViewProvider(pipe->Spine.getValue());
svp->setVisible(spineShow);
spineShow = false;
}

static_cast<ViewProviderPipe*>(vp)->highlightReferences(false, false);
}
static_cast<ViewProviderPipe*>(vp)->highlightReferences(false, false);


delete ui;
}

Expand Down Expand Up @@ -340,20 +343,22 @@ TaskPipeOrientation::TaskPipeOrientation(ViewProviderPipe* PipeView, bool /*newO
updateUI(pipe->Mode.getValue());
}

TaskPipeOrientation::~TaskPipeOrientation() {
TaskPipeOrientation::~TaskPipeOrientation()
{
if (vp) {
PartDesign::Pipe* pipe = static_cast<PartDesign::Pipe*>(vp->getObject());
Gui::Document* doc = vp->getDocument();

//make sure the user sees al important things: the base feature to select edges and the
//spine/auxilliary spine he already selected
if (pipe->AuxillerySpine.getValue()) {
auto* svp = doc->getViewProvider(pipe->AuxillerySpine.getValue());
svp->setVisible(auxSpineShow);
auxSpineShow = false;
}

PartDesign::Pipe* pipe = static_cast<PartDesign::Pipe*>(vp->getObject());
Gui::Document* doc = Gui::Application::Instance->activeDocument();

//make sure th euser sees al important things: the base feature to select edges and the
//spine/auxillery spine he already selected
if(pipe->AuxillerySpine.getValue()) {
auto* svp = doc->getViewProvider(pipe->AuxillerySpine.getValue());
svp->setVisible(auxSpineShow);
auxSpineShow = false;
static_cast<ViewProviderPipe*>(vp)->highlightReferences(false, true);
}

static_cast<ViewProviderPipe*>(vp)->highlightReferences(false, true);
}

void TaskPipeOrientation::onOrientationChanged(int idx) {
Expand Down

0 comments on commit bebda4c

Please sign in to comment.