From e1acf95da4614c980011689731a4ec4f7d8455c4 Mon Sep 17 00:00:00 2001 From: Beat Hangartner Date: Tue, 6 Oct 2026 16:55:25 +0200 Subject: [PATCH] Initialise the orientations of a default-constructed ConductorProfile ConductorProfile's default constructor leaves beginOrientation and endOrientation untouched, and the copy constructor and operator= then read them from such a profile when a conductor's profiles are stored in a QHash. UndefinedBehaviorSanitizer stops the binary there on every project with conductors: conductorprofile.cpp:42:23: runtime error: load of value 1869263360, which is not a valid value for type 'Qet::Orientation' #0 ConductorProfile::ConductorProfile(ConductorProfile const&) #2 QHashPrivate::Node::createInPlace Give both members a default value, Qet::North, in the header. No behaviour changes: a default-constructed profile is null (no segments) and its orientations are never used before fromConductor() sets them. No file-format change. Tests: the sanitizer build of the Linux CI job (separate PR) fails on master with the report above and passes with this change; all 23 example projects go through --export-svg and --resave under ASan/UBSan on macOS without a report. Co-Authored-By: Claude Fable 5.1 Signed-off-by: Beat Hangartner --- sources/conductorprofile.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/sources/conductorprofile.h b/sources/conductorprofile.h index 2697e60b0..1b4ceb273 100644 --- a/sources/conductorprofile.h +++ b/sources/conductorprofile.h @@ -38,10 +38,12 @@ class ConductorProfile { public: /// Segments composing the conductor QList segments; - /// Orientation of the start terminal - Qet::Orientation beginOrientation; + /// Orientation of the start terminal. Initialised because the default + /// constructor leaves it as is, and the copy constructor and operator= + /// then read it from such a profile. + Qet::Orientation beginOrientation = Qet::North; /// Orientation of the end terminal. - Qet::Orientation endOrientation; + Qet::Orientation endOrientation = Qet::North; // methods public: