Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #303585 added return from restore session if failed read score #5916

Conversation

igorkorsukov
Copy link
Contributor

@igorkorsukov igorkorsukov commented Apr 9, 2020

Resolves: https://musescore.org/en/node/303585

Problem: trying to get a view that is not exists and assert is triggered.
this happens when restoring a session if there is no score file

bool MuseScore::restoreSession(bool always)
{
...
    MasterScore* score = readScore(e.readElementText());
    if (score) {
        ...
        appendScore(score);  <= 1
   
    ...
   (tab3 == 0 ? tab1 : tab2)->initScoreView(idx1, vmag, magIdx, x, y);   <= 2
}

1 - Here should be added a view with score, but not added, because score is missing.
2 - Here get a view that does not exist

Fix: Added return from restoreSession if no score

Problem2: The procedure for opening the last file is done in 2 places - restoreSession and loadScores.

Therefore, if the session cannot be restored, then there will be another attempt to open the last file, and the user will be shown a second time a message stating that the file is missing (the first message was shown in restoreSession)

I don’t know why the opening of the last file was implemented in two places ... maybe for backward compatibility when the session functionality was introduced.

In order not to show the second message, if the file could not be read in restoreSession, then true is returned

  • I signed CLA
  • I made sure the code in the PR follows the coding rules
  • I made sure the code compiles on my machine
  • I made sure there are no unnecessary changes in the code
  • I made sure the title of the PR reflects the core meaning of the issue you are solving
  • I made sure the commit message(s) contain a description and answer the question "Why do those changes fix that particular issue?" or "Why are those changes really necessary as improvements?"
  • I made sure the commit message title starts with "fix #424242:" if there is a related issue

@igorkorsukov igorkorsukov force-pushed the tracker/303585_assert_on_reopen_removed_score branch from 37ebc6c to 43c4e5e Compare April 9, 2020 12:37
@anatoly-os anatoly-os merged commit b93f390 into musescore:master Apr 9, 2020
@igorkorsukov igorkorsukov deleted the tracker/303585_assert_on_reopen_removed_score branch April 28, 2020 12:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants