Scores get each other's titles on first edit after reordering tabs, crash on close

• Apr 21, 2017 - 00:48
Reported version
2.2
Type
Graphical (UI)
Severity
S2 - Critical
Status
closed
Project

2.1 RC

1. Open any two scores at once—say score1 and score2.
2. Drag one of their tabs to change the order.
3. Make any edit to either score.

Result 1: the title displayed in one of the tabs changes to be the same as the other.

Repeating steps 2 and 3 in different combinations, you can get both tabs to say score1, both tabs to say score2, score1's to say score2 and score2's to say score1, and even get them back to their original state.

4. With the tabs not in their original order, close one of the scores.

Result 2: crash.

My hunch is that it's not worth the effort to figure out what's going on, and it's simpler to just revert #8954: Move Tabs Around.


Comments

looking at scoretab.h:

class ScoreTab : public QWidget {
      Q_OBJECT
      QList* scoreList;
      QTabBar* tab;                 // list of scores
      QTabBar* tab2;                // list of excerpts for current score

So clearly there is a list. But I don't see anywhere where this list order is updated when a tab has been moved.

Oh, and I have a little pet peeve with non-descriptive variable names like "tab" and "tab2"...shouldn't need to have a comment explaining what those tabs are...would be better to just name those variables "tabScores" and "tabExcerpts". Then people will know what those variables refer to just by looking at the names.

When I move a tab around, the slot ScoreTab::setCurrent(int n) gets called with n equal to the new position of the moved tab. But again, I don't see any effort to update scoreList order.

As I mentioned in that PR, I forgot to test if there is a viewSplitter and if there is any particular thing I need to handle in case of split view. I'm away from my machine now to test this... It would be ok if each score tab has its own separate order of scoreList...but I have to look into this.

Status (old) patch (code needs review) fixed

Fixed in branch 2.1, commit df5d867bff

fix #190991 update scoreList order when tabMoved

Also update the tab order for the other ScoreTab.
However since scoreList is a shared pointer between both ScoreTabs, make sure to only update the pointer once.

Fixed in branch master, commit dd7fbe2657

fix #190991 update scoreList order when tabMoved

Also update the tab order for the other ScoreTab.
However since scoreList is a shared pointer between both ScoreTabs, make sure to only update the pointer once.