PartDesign/TaskMultiTransformParameters: fix a segfault
The segfault was caused by premature delete of object TaskMultiTransformParameter::subFeature refered to. Steps to reproduce: 1. Create a multitransform 2. Add a sub transfurmation to it 3. Press cancel
This commit is contained in:
parent
113c10a2b7
commit
9cba6c48ea
|
@ -460,22 +460,26 @@ bool TaskDlgMultiTransformParameters::accept()
|
|||
return TaskDlgFeatureParameters::accept ();
|
||||
}
|
||||
|
||||
bool TaskDlgMultiTransformParameters::reject()
|
||||
{
|
||||
// Get objects before view is invalidated
|
||||
// For the same reason we can't delegate showing the originals to TaskDlgTransformedParameters::reject()
|
||||
PartDesign::MultiTransform* pcMultiTransform = static_cast<PartDesign::MultiTransform*>(vp->getObject());
|
||||
std::vector<App::DocumentObject*> transformFeatures = pcMultiTransform->Transformations.getValues();
|
||||
|
||||
// Delete the transformation features - must happen before abortCommand()!
|
||||
for (std::vector<App::DocumentObject*>::const_iterator it = transformFeatures.begin(); it != transformFeatures.end(); ++it)
|
||||
{
|
||||
if ((*it) != NULL)
|
||||
Gui::Command::doCommand(
|
||||
Gui::Command::Doc,"App.ActiveDocument.removeObject(\"%s\")", (*it)->getNameInDocument());
|
||||
}
|
||||
|
||||
return TaskDlgTransformedParameters::reject();
|
||||
}
|
||||
// FIXME: It seems all roll back is finely handled by abortCommand() in parent classes. On the other
|
||||
// hand manual removal of objects may lead to segfault in dialog distructer of subtransformation
|
||||
// due to TaskMultiTransformParameters::getSubFeature() returns already destroid object. So check
|
||||
// that everything is fine and delete the method. (2015-07-31, Fat-Zer)
|
||||
//bool TaskDlgMultiTransformParameters::reject()
|
||||
//{
|
||||
// // Get objects before view is invalidated
|
||||
// // For the same reason we can't delegate showing the originals to TaskDlgTransformedParameters::reject()
|
||||
// PartDesign::MultiTransform* pcMultiTransform = static_cast<PartDesign::MultiTransform*>(vp->getObject());
|
||||
// std::vector<App::DocumentObject*> transformFeatures = pcMultiTransform->Transformations.getValues();
|
||||
//
|
||||
// // Delete the transformation features - must happen before abortCommand()!
|
||||
// for (std::vector<App::DocumentObject*>::const_iterator it = transformFeatures.begin(); it != transformFeatures.end(); ++it)
|
||||
// {
|
||||
// if ((*it) != NULL)
|
||||
// Gui::Command::doCommand(
|
||||
// Gui::Command::Doc,"App.ActiveDocument.removeObject(\"%s\")", (*it)->getNameInDocument());
|
||||
// }
|
||||
//
|
||||
// return TaskDlgTransformedParameters::reject();
|
||||
//}
|
||||
|
||||
#include "moc_TaskMultiTransformParameters.cpp"
|
||||
|
|
|
@ -115,7 +115,7 @@ public:
|
|||
/// 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();
|
||||
};
|
||||
|
||||
} //namespace PartDesignGui
|
||||
|
|
Loading…
Reference in New Issue
Block a user