DEBUG version crashes when opening Format > Page Settings on a part

• Jan 30, 2020 - 07:30
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) and lid=0, but probably just because that is the first element

This 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.