Crash when pasting measures if number > to the last mm rest

• Dec 4, 2018 - 19:09
Reported version
3.0
Priority
P0 - Critical
Type
Functional
Frequency
Once
Severity
S2 - Critical
Reproducibility
Always
Status
closed
Regression
No
Workaround
No
Project

The program crashes when attempting to paste full measures onto empty measures, where the number of empty measures is less than the number of full measures (ex. Pasting 7 full measures onto 5 empty measures). This occurs when the empty measures are the last measures of the piece, so the piece length is shorter than the duration being pasted. I have been able to reproduce this consistently.

I am running macOS Mojave 10.14.2 Beta.

Info From MuseScore About:
OS: macOS 10.14, Arch.: x86_64, MuseScore version (64-bit): 3.0.0.19499, revision: 0526317


Comments

With the current revision, I can reproduce if MM rests are enabled.
I cannot if MM rests are disabled.
Is it the issue you encounter?

Title MuseScore crashes when trying to paste more measures than there are blank measures Crash when pasting measures if number > to the last mm rest
Frequency Many Once
Severity S3 - Major S2 - Critical
Type Performance Functional

See:

Video.gif

Frequency Once Many

MuseScore/libmscore/utils.cpp:Ms::Score::tick2measureMM: tick2measureMM 11520 (max 5760) not found
Fails in line 418 of past.cpp which is two lines later the reason for the crash.
The easy 'fix' is to add a && endM && which does actually work but then checkMeasure isn't called and we better do.
The problem is, that dstM does already have _next a nullptr which is confusing at this point because with the 'fix' the measure is there and the database not corrupted. I'll dig further tomorrow. So far my PR is here: https://github.com/musescore/MuseScore/pull/4312

Status active PR created

After some more thoughts, the use of the nextMeasureMM and tick2measureMM is obsolete and we should use the functions without MM here, because the MM is still present while copying here and will be removed at a later point.

@fbrauchle that seems to be similar to a reason why I moved selection from there to happen after layout: see PR 4133 (and 4214 for the latter fix). Though this may be not necessary to apply for checking measures: there seem to be no evident reasons to check MM rests for gaps presence.