PartDesign/TaskDressUpParameters: fix a crash when editing a broken object
This commit is contained in:
parent
0ca40ed48b
commit
9feff04aad
|
@ -75,6 +75,7 @@ const bool TaskDressUpParameters::referenceSelected(const Gui::SelectionChanges&
|
||||||
|
|
||||||
PartDesign::DressUp* pcDressUp = static_cast<PartDesign::DressUp*>(DressUpView->getObject());
|
PartDesign::DressUp* pcDressUp = static_cast<PartDesign::DressUp*>(DressUpView->getObject());
|
||||||
App::DocumentObject* base = this->getBase();
|
App::DocumentObject* base = this->getBase();
|
||||||
|
|
||||||
// TODO: Must we make a copy here instead of assigning to const char* ?
|
// TODO: Must we make a copy here instead of assigning to const char* ?
|
||||||
const char* fname = base->getNameInDocument();
|
const char* fname = base->getNameInDocument();
|
||||||
if (strcmp(msg.pObjectName, fname) != 0)
|
if (strcmp(msg.pObjectName, fname) != 0)
|
||||||
|
@ -168,10 +169,14 @@ void TaskDressUpParameters::showObject()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
App::DocumentObject* TaskDressUpParameters::getBase(void) const
|
Part::Feature* TaskDressUpParameters::getBase(void) const
|
||||||
{
|
{
|
||||||
PartDesign::DressUp* pcDressUp = static_cast<PartDesign::DressUp*>(DressUpView->getObject());
|
PartDesign::DressUp* pcDressUp = static_cast<PartDesign::DressUp*>(DressUpView->getObject());
|
||||||
return pcDressUp->Base.getValue();
|
// Unlikely but this may throw an exception in case we are started to edit an object which base feature
|
||||||
|
// was deleted. This exception will be likely unhandled inside the dialog and pass upper, But an error
|
||||||
|
// message inside the report view is better than a SEGFAULT.
|
||||||
|
// TODO: generally this situation should be prevented in ViewProviderDressUp
|
||||||
|
return pcDressUp->getBaseObject();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TaskDressUpParameters::exitSelectionMode()
|
void TaskDressUpParameters::exitSelectionMode()
|
||||||
|
|
|
@ -32,6 +32,10 @@
|
||||||
|
|
||||||
class QListWidget;
|
class QListWidget;
|
||||||
|
|
||||||
|
namespace Part {
|
||||||
|
class Feature;
|
||||||
|
}
|
||||||
|
|
||||||
namespace PartDesignGui {
|
namespace PartDesignGui {
|
||||||
|
|
||||||
class TaskDressUpParameters : public Gui::TaskView::TaskBox, public Gui::SelectionObserver
|
class TaskDressUpParameters : public Gui::TaskView::TaskBox, public Gui::SelectionObserver
|
||||||
|
@ -43,7 +47,7 @@ public:
|
||||||
virtual ~TaskDressUpParameters();
|
virtual ~TaskDressUpParameters();
|
||||||
|
|
||||||
const std::vector<std::string> getReferences(void) const;
|
const std::vector<std::string> getReferences(void) const;
|
||||||
App::DocumentObject *getBase(void) const;
|
Part::Feature *getBase(void) const;
|
||||||
|
|
||||||
void hideObject();
|
void hideObject();
|
||||||
void showObject();
|
void showObject();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user