Volta/Ottava/Pedal lines disappear when switching language

• Mar 26, 2021 - 05:35
Reported version
3.6
Type
Functional
Frequency
Once
Severity
S3 - Major
Reproducibility
Always
Status
active
Regression
No
Workaround
Yes
Project

OS: macOS High Sierra (10.13)
Arch.: x86_64, MuseScore version (64-bit): 3.6.2.548020600
revision: 3224f34

Step to reproduce:
1.Insert Volta or Ottava or Pedal line via Line Palette
volta4.jpg

2.Switch language to another. (it happens in any combination)

Result:
Line disappears. (img is Volta)
volta1.jpg

And Line style also disappear via format ->style
volta2.jpg

Workaround:
[I’m not 100% sure, sometime it doesn’t work..]
Clicking Reset to default button & relstart MuseScore
vota3.jpg

Attachment Size
volta4.jpg 67.34 KB
volta1.jpg 21.69 KB
volta2.jpg 28.94 KB
vota3.jpg 21.99 KB

Comments

It crashes when I try it on that score

Only on the 1st attempt, can't reproduce the crash, mit relate so something I did in the session before that

I still can't reproduce the vanishing volta line

Status needs info active

OK, with that I can reproduce it

Format > Style > Volta > Line style is empty then
As are all other line styles (ottava and pedal).

Suspicion: those get stored in the score or in memory using their translated names?

I might have found the culprit...

Compare the code from the constructor (EditStyle::EditStyle(Score s, QWidget parent)):

      int dta = 1;
      voltaLineStyle->clear();
      ottavaLineStyle->clear();
      pedalLineStyle->clear();
      for (const char* p : lineStyles) {
            QString trs = qApp->translate("EditStyleBase", p);
            voltaLineStyle->addItem(trs, dta);
            ottavaLineStyle->addItem(trs, dta);
            pedalLineStyle->addItem(trs, dta);
            ++dta;
            }

with that from where the retranslation happens (void EditStyle::retranslate()):

      int index = 0;
      for (const char* p : lineStyles) {
            QString trs = qApp->translate("EditStyleBase", p);
            voltaLineStyle->setItemText(index, trs);
            voltaLineStyle->setItemText(index, trs);
            ottavaLineStyle->setItemText(index, trs);
            pedalLineStyle->setItemText(index, trs);
            ++index;
            }

Looks like a classic off-by-one error to me (and a duplicate line too)

Well, if my code change for MuseScore 3 doesn't fix it, I'm not sure the same issue won't happen in MuseScore 4.

How did you reproduce the issue with the GitHub artifact?

There a re a few diffences between my self built version vs. GitHub artifact:

  • MinGW vs. MSVC
  • Debug vs. RelWithDebInfo
  • Qt 5.15.2 vs. Qt 5.9.8

From these the last one seems the most likely candidate

Status PR created fixed

Fixed in branch 3.x, commit 072a0a19e3

_Fix #319242, fix #319020: Volta/Ottava/Pedal lines disappear when switching language

and while at it also remove a duplicate line and an unused variable_