Skip to content

Commit

Permalink
fix #2662 - crash when create ShapeBinder with origin selected
Browse files Browse the repository at this point in the history
  • Loading branch information
usakhelo authored and wwmayer committed Dec 2, 2016
1 parent 2313b05 commit 261bc46
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 32 deletions.
2 changes: 1 addition & 1 deletion src/Mod/PartDesign/App/ShapeBinder.cpp
Expand Up @@ -89,7 +89,7 @@ void ShapeBinder::getFilteredReferences(App::PropertyLinkSubList* prop, Part::Fe

//we only allow one part feature, so get the first one we find
size_t index = 0;
while(!objs[index]->isDerivedFrom(Part::Feature::getClassTypeId()) && index < objs.size())
while(index < objs.size() && !objs[index]->isDerivedFrom(Part::Feature::getClassTypeId()))
index++;

//do we have any part feature?
Expand Down
38 changes: 8 additions & 30 deletions src/Mod/PartDesign/Gui/TaskShapeBinder.cpp
Expand Up @@ -317,35 +317,13 @@ bool TaskDlgShapeBinder::accept()
return true;
}

//bool TaskDlgShapeBinder::reject()
//{
// // get the support and Sketch
// PartDesign::Pipe* pcPipe = static_cast<PartDesign::Pipe*>(PipeView->getObject());
// Sketcher::SketchObject *pcSketch = 0;
// App::DocumentObject *pcSupport = 0;
// if (pcPipe->Sketch.getValue()) {
// pcSketch = static_cast<Sketcher::SketchObject*>(pcPipe->Sketch.getValue());
// pcSupport = pcSketch->Support.getValue();
// }
//
// // roll back the done things
// Gui::Command::abortCommand();
// Gui::Command::doCommand(Gui::Command::Gui,"Gui.activeDocument().resetEdit()");
//
// // if abort command deleted the object the support is visible again
// if (!Gui::Application::Instance->getViewProvider(pcPipe)) {
// if (pcSketch && Gui::Application::Instance->getViewProvider(pcSketch))
// Gui::Application::Instance->getViewProvider(pcSketch)->show();
// if (pcSupport && Gui::Application::Instance->getViewProvider(pcSupport))
// Gui::Application::Instance->getViewProvider(pcSupport)->show();
// }
//
// //Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.recompute()");
// //Gui::Command::commitCommand();
//
// return true;
//}


bool TaskDlgShapeBinder::reject()
{
// roll back the done things
Gui::Command::abortCommand();
Gui::Command::doCommand(Gui::Command::Gui, "Gui.activeDocument().resetEdit()");
Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()");
return true;
}

#include "moc_TaskShapeBinder.cpp"
2 changes: 1 addition & 1 deletion src/Mod/PartDesign/Gui/TaskShapeBinder.h
Expand Up @@ -94,7 +94,7 @@ class TaskDlgShapeBinder : public Gui::TaskView::TaskDialog
/// is called by the framework if the dialog is accepted (Ok)
virtual bool accept();
/// is called by the framework if the dialog is rejected (Cancel)
//virtual bool reject();
virtual bool reject();

protected:
TaskShapeBinder *parameter;
Expand Down

0 comments on commit 261bc46

Please sign in to comment.