From 7e8a65b82bf953c43a665d37c584c68c533041a8 Mon Sep 17 00:00:00 2001 From: Benjamin Nauck Date: Fri, 20 Jun 2025 10:59:06 +0200 Subject: [PATCH] Sketcher: Initialize constraint members in class declaration --- src/Mod/Sketcher/App/Constraint.cpp | 15 -------------- src/Mod/Sketcher/App/Constraint.h | 31 +++++++++++++++-------------- 2 files changed, 16 insertions(+), 30 deletions(-) diff --git a/src/Mod/Sketcher/App/Constraint.cpp b/src/Mod/Sketcher/App/Constraint.cpp index 5b66154279..e9f7dae4c6 100644 --- a/src/Mod/Sketcher/App/Constraint.cpp +++ b/src/Mod/Sketcher/App/Constraint.cpp @@ -44,21 +44,6 @@ using namespace Base; TYPESYSTEM_SOURCE(Sketcher::Constraint, Base::Persistence) Constraint::Constraint() - : Value(0.0) - , Type(None) - , AlignmentType(Undef) - , First(GeoEnum::GeoUndef) - , FirstPos(PointPos::none) - , Second(GeoEnum::GeoUndef) - , SecondPos(PointPos::none) - , Third(GeoEnum::GeoUndef) - , ThirdPos(PointPos::none) - , LabelDistance(10.f) - , LabelPosition(0.f) - , isDriving(true) - , InternalAlignmentIndex(-1) - , isInVirtualSpace(false) - , isActive(true) { // Initialize a random number generator, to avoid Valgrind false positives. // The random number generator is not threadsafe so we guard it. See diff --git a/src/Mod/Sketcher/App/Constraint.h b/src/Mod/Sketcher/App/Constraint.h index 4047a238a8..8989358b75 100644 --- a/src/Mod/Sketcher/App/Constraint.h +++ b/src/Mod/Sketcher/App/Constraint.h @@ -166,7 +166,7 @@ private: Constraint(const Constraint&) = default; // only for internal use private: - double Value; + double Value {0.0}; // clang-format off constexpr static std::array type2str { @@ -207,24 +207,25 @@ private: "ParabolaFocalAxis"}}; public: - ConstraintType Type; - InternalAlignmentType AlignmentType; + ConstraintType Type {None}; + InternalAlignmentType AlignmentType {Undef}; std::string Name; - int First; - PointPos FirstPos; - int Second; - PointPos SecondPos; - int Third; - PointPos ThirdPos; - float LabelDistance; - float LabelPosition; - bool isDriving; + int First {GeoEnum::GeoUndef}; + PointPos FirstPos {PointPos::none}; + int Second {GeoEnum::GeoUndef}; + PointPos SecondPos {PointPos::none}; + int Third {GeoEnum::GeoUndef}; + PointPos ThirdPos {PointPos::none}; + float LabelDistance {10.F}; + float LabelPosition {0.F}; + bool isDriving {true}; // Note: for InternalAlignment Type this index indexes equal internal geometry elements (e.g. // index of pole in a bspline). It is not a GeoId!! - int InternalAlignmentIndex; - bool isInVirtualSpace; + int InternalAlignmentIndex {-1}; + bool isInVirtualSpace {false}; + + bool isActive {true}; - bool isActive; protected: boost::uuids::uuid tag;