+ fix possible crashes in mirror and polar pattern feature

This commit is contained in:
wmayer
2014-03-31 16:35:22 +02:00
parent aaeba38e78
commit e47b85994c
4 changed files with 33 additions and 12 deletions

View File

@@ -370,13 +370,18 @@ bool TaskDlgPolarPatternParameters::accept()
TaskPolarPatternParameters* polarpatternParameter = static_cast<TaskPolarPatternParameters*>(parameter);
std::string axis = polarpatternParameter->getAxis();
if (!axis.empty()) {
QString buf = QString::fromUtf8("(App.ActiveDocument.%1,[\"%2\"])");
App::DocumentObject* sketch = 0;
if (axis == "N_Axis")
buf = buf.arg(QString::fromUtf8(polarpatternParameter->getSketchObject()->getNameInDocument()));
sketch = polarpatternParameter->getSketchObject();
else
buf = buf.arg(QString::fromUtf8(polarpatternParameter->getSupportObject()->getNameInDocument()));
buf = buf.arg(QString::fromUtf8(axis.c_str()));
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Axis = %s", name.c_str(), buf.toStdString().c_str());
sketch = polarpatternParameter->getSupportObject();
if (sketch) {
QString buf = QString::fromLatin1("(App.ActiveDocument.%1,[\"%2\"])");
buf = buf.arg(QString::fromLatin1(sketch->getNameInDocument()));
buf = buf.arg(QString::fromLatin1(axis.c_str()));
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Axis = %s", name.c_str(), buf.toStdString().c_str());
}
} else
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Axis = None", name.c_str());
Gui::Command::doCommand(Gui::Command::Doc,"App.ActiveDocument.%s.Reversed = %u",name.c_str(),polarpatternParameter->getReverse());