DEBUG version crashes when opening Format > Page Settings on a part
Reported version
3.4
Priority
P1 - High
Type
Functional
Frequency
Once
Severity
S3 - Major
Reproducibility
Always
Status
active
Regression
No
Workaround
No
Project
In a selfbuild MuseScore in DEBUG mode (like QtCreator/MinGW) and a score with parts open the Format > Pagesetting dialog for a part.
Result; crash/abort due to a failed assertion in libmscore/xml.h, line 275
This gets called only once in the source, from libmscore/element.cpp, line 565
While there is no crash in and non-DEBUG version, this failed assertion should indicate that there is a problem, even if it seems to have no further consequences. like it would write a most probably bogus value for indexDiff
into the score.
I stumbled accross this while working in a fix for #300279: Impossible to apply properties to all parts in 3.4.1
Comments
Adding some debug output shows that, at least in my test case, it is about a
VBox
(Vertical frame, AKA title frame) andlid=0
, but probably just because that is the first elementThis local index which is missing here gets assigned a few lines above for "main" element in the relevant linked elements list. If only a part gets written to MSCX then master score doesn't get written and links between master score and parts do not get this index. So this issue should appear every time when we try to save a single part — and I indeed see the same assertion failure when I try to save a single part from File→Save As menu. This actually may happen to lead to issues with links in such saved files, so assertion failure seems to indicate a real problem indeed.
So let's raise severity
That code got introduced with 41366f5a in 17 Jun 2018, so is in 3.x ever since, but not in 2.x.
The assert got added in 907a4dcc3, in 3 Nov 2019, so for 3.4, to fix #296426: Text attached to mmrest preceded by another mmrest ending with custom barlines loses custom position on reload
So far for the forensics ;-)
Also, when disabling that assert, I see tons of warnings, from libmscore/element.cpp, line 672 like
Warning: Element::readProperties: could not link VBox at staff 1