Regression: use of navigator affects all open scores

• Apr 5, 2017 - 12:50
Reported version
2.2
Type
Functional
Severity
S3 - Major
Status
closed
Project

Score with more than one page, parts with 1 page, Navigator enabled
Switch to part: you're on page 1 (the only page)
Switch to score, navigate to some page other than the 1st, using the navigator
Switch back to part: now the Navigator is out of scope in 2.1 (3c7a69d), but not in 2.0.3


Comments

"because without that the blue rectangle doesn't show at all."
True, and so, impossible to check further/elsewhere here.

I believe the problem is due to this:

https://github.com/musescore/MuseScore/commit/80ee93e2358fd2bf3f6e501d2…

The effect of this that when switching tabs, Navigator::_cv gets cleared, so then we we eventually get to Navigator::setScoreView(), we don't disconnect the signals from the previous tab. Meaning that even after leaving the part tab and returning to the score, the part continues to receive signals when you access the Navigator. Note the bug only affects parts you have actually visited; parts you haven't viewed won't have ever connected signals.

Commenting out the call to navigator()->setScore() that the above commit added fixes the problem, but presumably the bug that was fixing gets unfixed - except I can't reproduce that problem even with that line commented out. I guess maybe also switching the order of the calls to setScore(0 and setCurrentScoreView(), but I don't know if that really makes sense (EDIT: nope, this breaks the Navigator completely). I'm not really comfortable with this aspect of the code, but hopefully the investigation helps.

Then maybe disconnecting signals within Navigastor::setScore(), or just eliminating the line that clears _cv?

BTW, this doesn't just affect parts - all scores you have open are affected. Switch tabs, move the Navigator, return to the previous tab, and you'll see you've moved the score view there as well.

I don't understand the reasoning behind calling navigator->setScore(cs) from within MuseScore::setCurrentScoreView(view) in the first place. It seems navigator->setCurrentView(view) already sets the current score if there is one. If I comment out the call to setScore(), I still can't reproduce the issue that was supposedly fixing, but maybe something else changed that makes this unnecessary?

Anyhow, for me either of the following works:

- remove the call to setScore()

or

- remove the line clearing _cv from setScore()

Either seems to work with no ill effects that I can see. But obviously there have been issues in this area and there are subtle interactions I probably don't understand. Some special sequence of operations in which the setScore(0 ends up being necessary, or in which clearing _cv is necessary.

Title Regression: navigating in score navigates in part to out of scope Regression: use of navigator affects all open scores

Title changed to reflect actual situation.

Status (old) active patch (code needs review)

The original order of calls to setScoreView() and setScore() makes more sense, I think, so my PR restores that. That in itself fixes the issue at hand. Commenting out the line that clears _cv fixes the problem with the blue rectangle not showing. I could have removed that line but left the order of calls the same, but I do think the original order made more sense and was more consistent with elsewhere in the code.

https://github.com/musescore/MuseScore/pull/3155