diff --git a/src/Gui/Document.cpp b/src/Gui/Document.cpp index 512001d671..ad4ccc5796 100644 --- a/src/Gui/Document.cpp +++ b/src/Gui/Document.cpp @@ -1054,9 +1054,9 @@ void Document::createView(const Base::Type& typeId) std::list theViews = this->getMDIViewsOfType(typeId); if (typeId == View3DInventor::getClassTypeId()) { - View3DInventor* firstView = 0; View3DInventor* view3D = new View3DInventor(this, getMainWindow()); - if (firstView) { + if (!theViews.empty()) { + View3DInventor* firstView = static_cast(theViews.front()); std::string overrideMode = firstView->getViewer()->getOverrideMode(); view3D->getViewer()->setOverrideMode(overrideMode); } diff --git a/src/Mod/Part/Gui/TaskAttacher.cpp b/src/Mod/Part/Gui/TaskAttacher.cpp index cf482671aa..a751027b09 100644 --- a/src/Mod/Part/Gui/TaskAttacher.cpp +++ b/src/Mod/Part/Gui/TaskAttacher.cpp @@ -896,7 +896,7 @@ void TaskAttacher::visibilityAutomation(bool opening_not_closing) //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ TaskDlgAttacher::TaskDlgAttacher(Gui::ViewProviderDocumentObject *ViewProvider, bool createBox) - : TaskDialog(),ViewProvider(ViewProvider) + : TaskDialog(),ViewProvider(ViewProvider), parameter(nullptr) { assert(ViewProvider); diff --git a/src/Mod/Sketcher/Gui/CommandConstraints.cpp b/src/Mod/Sketcher/Gui/CommandConstraints.cpp index e7c3b1bf36..1265b84bc4 100644 --- a/src/Mod/Sketcher/Gui/CommandConstraints.cpp +++ b/src/Mod/Sketcher/Gui/CommandConstraints.cpp @@ -798,7 +798,8 @@ namespace SketcherGui { App::DocumentObject* object; public: GenericConstraintSelection(App::DocumentObject* obj) - : Gui::SelectionFilterGate((Gui::SelectionFilter*)0), object(obj) + : Gui::SelectionFilterGate((Gui::SelectionFilter*)0) + , object(obj), allowedSelTypes(0) {} bool allow(App::Document *, App::DocumentObject *pObj, const char *sSubName) @@ -913,7 +914,7 @@ class DrawSketchHandlerGenConstraint: public DrawSketchHandler { public: DrawSketchHandlerGenConstraint(const char* cursor[], CmdSketcherConstraint *_cmd) - : constraintCursor(cursor), cmd(_cmd) {} + : constraintCursor(cursor), cmd(_cmd), seqIndex(0) {} virtual ~DrawSketchHandlerGenConstraint() { Gui::Selection().rmvSelectionGate(); @@ -3521,7 +3522,10 @@ void CmdSketcherConstrainPerpendicular::activated(int iMsg) const Part::Geometry *geo1 = Obj->getGeometry(GeoId1); const Part::Geometry *geo2 = Obj->getGeometry(GeoId2); - + if (!geo1 || !geo2) { + return; + } + if (geo1->getTypeId() != Part::GeomLineSegment::getClassTypeId() && geo2->getTypeId() != Part::GeomLineSegment::getClassTypeId()) { QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), @@ -3529,9 +3533,8 @@ void CmdSketcherConstrainPerpendicular::activated(int iMsg) return; } - if( geo1 && geo2 && - ( geo1->getTypeId() == Part::GeomBSplineCurve::getClassTypeId() || - geo2->getTypeId() == Part::GeomBSplineCurve::getClassTypeId() )){ + if (geo1->getTypeId() == Part::GeomBSplineCurve::getClassTypeId() || + geo2->getTypeId() == Part::GeomBSplineCurve::getClassTypeId()){ // unsupported until tangent to BSpline at any point implemented. QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), @@ -3546,10 +3549,10 @@ void CmdSketcherConstrainPerpendicular::activated(int iMsg) geo1 = Obj->getGeometry(GeoId1); geo2 = Obj->getGeometry(GeoId2); - if( geo1->getTypeId() == Part::GeomEllipse::getClassTypeId() || + if (geo1->getTypeId() == Part::GeomEllipse::getClassTypeId() || geo1->getTypeId() == Part::GeomArcOfEllipse::getClassTypeId() || geo1->getTypeId() == Part::GeomArcOfHyperbola::getClassTypeId() || - geo1->getTypeId() == Part::GeomArcOfParabola::getClassTypeId() ) { + geo1->getTypeId() == Part::GeomArcOfParabola::getClassTypeId()) { Base::Vector3d center; Base::Vector3d majdir; @@ -3705,6 +3708,9 @@ void CmdSketcherConstrainPerpendicular::applyConstraint(std::vector & const Part::Geometry *geo1 = Obj->getGeometry(GeoId1); const Part::Geometry *geo2 = Obj->getGeometry(GeoId2); + if (!geo1 || !geo2) { + return; + } if (geo1->getTypeId() != Part::GeomLineSegment::getClassTypeId() && geo2->getTypeId() != Part::GeomLineSegment::getClassTypeId()) { @@ -3713,9 +3719,8 @@ void CmdSketcherConstrainPerpendicular::applyConstraint(std::vector & return; } - if( geo1 && geo2 && - ( geo1->getTypeId() == Part::GeomBSplineCurve::getClassTypeId() || - geo2->getTypeId() == Part::GeomBSplineCurve::getClassTypeId() )){ + if (geo1->getTypeId() == Part::GeomBSplineCurve::getClassTypeId() || + geo2->getTypeId() == Part::GeomBSplineCurve::getClassTypeId()){ // unsupported until tangent to BSpline at any point implemented. QMessageBox::warning(Gui::getMainWindow(), QObject::tr("Wrong selection"), diff --git a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp index 5aaa2bd2fc..1833f53314 100644 --- a/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp +++ b/src/Mod/Sketcher/Gui/CommandCreateGeo.cpp @@ -3872,6 +3872,10 @@ public: DrawSketchHandlerArcOfParabola() : Mode(STATUS_SEEK_First) , EditCurve(34) + , startAngle(0) + , endAngle(0) + , arcAngle(0) + , arcAngle_t(0) { } virtual ~DrawSketchHandlerArcOfParabola(){} @@ -4150,7 +4154,7 @@ protected: SelectMode Mode; std::vector EditCurve; Base::Vector2d focusPoint, axisPoint, startingPoint, endPoint; - double rx, ry, startAngle, endAngle, arcAngle, arcAngle_t; + double startAngle, endAngle, arcAngle, arcAngle_t; std::vector sugConstr1, sugConstr2, sugConstr3, sugConstr4; };