mirror of
https://github.com/qelectrotech/qelectrotech-source-mirror.git
synced 2026-09-29 05:44:14 +02:00
3af551583c
QETProject::toXml() iterated defaultXRefProperties().keys() straight into the document. That is a QHash, and Qt randomises hash iteration order per process, so every save wrote the <xref> children in a different sequence. Saving an unchanged project therefore produced a different file each time. The content was identical -- same size, same elements -- but the order moved, so version control showed spurious changes on every save and comparing two saved files showed differences that were not there. Sorting the keys before writing makes a save reproducible. This is the same class of problem, and the same fix, as the sort already applied to Diagram::toXml()'s <elements> and <conductors> blocks. Measured with tests/determinism (resave twice, compare): before: I1 idempotent save 0/23 after: I1 idempotent save 5/23 with ArduinoLCD, ShellyParts, convertisseur, schema_indus and schema_unifilaire_voltaique2 newly reproducible, and no regressions against the baseline. Not the only remaining source of save instability -- the other 18 projects still fail I1 for other reasons. This fixes the hash-ordering source only. Note this is not a Qt6 regression. The Qt5 build happened to produce a favourable hash order for four projects and Qt6 does not, but both were writing an unspecified order; only the dice changed. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>