0000906: Segmentation Fault when try to use linear pattern on Part, fix some issues with selection gate

This commit is contained in:
wmayer 2012-12-07 14:01:49 +01:00
parent 3cc9818713
commit 515f30c1a0
7 changed files with 27 additions and 6 deletions

View File

@ -610,9 +610,17 @@ void SelectionSingleton::addSelectionGate(Gui::SelectionGate *gate)
// remove the active SelectionGate
void SelectionSingleton::rmvSelectionGate(void)
{
if (ActiveGate)
if (ActiveGate) {
delete ActiveGate;
ActiveGate=0;
ActiveGate=0;
Gui::Document* doc = Gui::Application::Instance->activeDocument();
if (doc) {
Gui::MDIView* mdi = doc->getActiveView();
if (mdi && mdi->isDerivedFrom(View3DInventor::getClassTypeId())) {
static_cast<View3DInventor*>(mdi)->setCursor(Qt::ArrowCursor);
}
}
}
}

View File

@ -107,8 +107,8 @@ App::DocumentObjectExecReturn *Revolution::execute(void)
// get reference axis
App::DocumentObject *pcReferenceAxis = ReferenceAxis.getValue();
const std::vector<std::string> &subReferenceAxis = ReferenceAxis.getSubValues();
bool hasValidAxis=false;
if (pcReferenceAxis && pcReferenceAxis == sketch) {
bool hasValidAxis=false;
Base::Axis axis;
if (subReferenceAxis[0] == "V_Axis") {
hasValidAxis = true;
@ -133,6 +133,9 @@ App::DocumentObjectExecReturn *Revolution::execute(void)
Axis.setValue(dir.x,dir.y,dir.z);
}
}
if (!hasValidAxis) {
return new App::DocumentObjectExecReturn("No valid reference axis defined");
}
// get revolve axis
Base::Vector3f b = Base.getValue();

View File

@ -125,10 +125,14 @@ App::DocumentObjectExecReturn *Transformed::execute(void)
if ((*o)->getTypeId().isDerivedFrom(PartDesign::Additive::getClassTypeId())) {
PartDesign::Additive* addFeature = static_cast<PartDesign::Additive*>(*o);
shape = addFeature->AddShape.getShape()._Shape;
if (shape.IsNull())
return new App::DocumentObjectExecReturn("Shape of additive feature is empty");
fuse = true;
} else if ((*o)->getTypeId().isDerivedFrom(PartDesign::Subtractive::getClassTypeId())) {
PartDesign::Subtractive* subFeature = static_cast<PartDesign::Subtractive*>(*o);
shape = subFeature->SubShape.getShape()._Shape;
if (shape.IsNull())
return new App::DocumentObjectExecReturn("Shape of subtractive feature is empty");
fuse = false;
} else {
return new App::DocumentObjectExecReturn("Only additive and subtractive features can be transformed");

View File

@ -315,6 +315,7 @@ App::DocumentObject* TaskDraftParameters::getBase(void) const
TaskDraftParameters::~TaskDraftParameters()
{
Gui::Selection().rmvSelectionGate();
delete ui;
}

View File

@ -104,7 +104,7 @@ TaskRevolutionParameters::TaskRevolutionParameters(ViewProviderRevolution *Revol
}
if (pos < 0 || pos >= ui->axis->count()) {
ui->axis->addItem(QString::fromAscii("Undefined"));
ui->axis->addItem(tr("Undefined"));
pos = ui->axis->count()-1;
}

View File

@ -76,6 +76,12 @@ TaskTransformedParameters::TaskTransformedParameters(TaskMultiTransformParameter
originalSelectionMode = false;
}
TaskTransformedParameters::~TaskTransformedParameters()
{
// make sure to remove selection gate in all cases
Gui::Selection().rmvSelectionGate();
}
const bool TaskTransformedParameters::originalSelected(const Gui::SelectionChanges& msg)
{
if (msg.Type == Gui::SelectionChanges::AddSelection && originalSelectionMode) {

View File

@ -56,8 +56,7 @@ public:
TaskTransformedParameters(ViewProviderTransformed *TransformedView, QWidget *parent = 0);
/// Constructor for task with parent task (MultiTransform mode)
TaskTransformedParameters(TaskMultiTransformParameters *parentTask);
virtual ~TaskTransformedParameters()
{}
virtual ~TaskTransformedParameters();
const std::vector<App::DocumentObject*> getOriginals(void) const;
/// Get the support object either of the object associated with this feature or with the parent feature (MultiTransform mode)