MuseScore takes very long on opening some 2.X scores

• Apr 17, 2020 - 00:14
Reported version
3.x-dev
Type
Functional
Frequency
Few
Severity
S2 - Critical
Reproducibility
Always
Status
closed
Regression
Yes
Workaround
No
Project

1) Open a score from https://musescore.com/openscore/scores/4861738 (can't attach it here since it exceeds the limit of 4MB)

Result: MuseScore hangs.
According to debugger it hangs somewhere around this line, possibly in the surrounding loop.

Tested on current master, 3.4.2 version opens this file just fine.

OS: Debian GNU/Linux 10 (buster), Arch.: x86_64, MuseScore version (64-bit): 3.5.0, revision: a5c92e2


Comments

Actually, it does not hang. If you let it run sufficiently long, then the score is (finally) loaded.
The problem got introduced with my PR in commit 78d9a2978c72e : the problem is that, for 2.x import, each time a style text should be read, the whole xml file up to the point where the text xml tag appears is read (again). For very long files full of texts (as the example), this requires a (very) long time.
I am trying to see if it is possible to read the style in a different way (without reintroducing the bug which that PR was solving).

Fix version
3.5.0