mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-10-07 20:34:14 +02:00
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<Qt::Corner, ConductorProfile>::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 <noreply@anthropic.com>
Signed-off-by: Beat Hangartner <beat@hangartners.ch>
This commit is contained in:
@@ -38,10 +38,12 @@ class ConductorProfile {
|
||||
public:
|
||||
/// Segments composing the conductor
|
||||
QList<ConductorSegmentProfile *> 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:
|
||||
|
||||
Reference in New Issue
Block a user