crash when changing 1st measure to a pickup measure

• Mar 28, 2014 - 13:12
Type
Functional
Severity
S2 - Critical
Status
closed
Project
Tags

Take Promenade_Example and change the 1st measure's actual duration -> Crash

Windows 7 Enterprise 64bit, self compiled 448c2cf


Comments

To me, it dies in fraction.cpp, line 196 (func Fraction::ticks() ). The last meaningful call is made in measure.cpp, line 1676 (func Measure::adjustToLen() ).

The problem seems related to the measure rest in LH staff, which has a _duration of 0/0! It is not recognized as a measure rest in line 1670 and any attempt to compute its ticks raises a division by 0 fault.

May be an artifact of the score being an old 1.x score? Trying on a new 2.0 score with a measure rest, there is no problem...

M.

I could trace the problem down to TDuration(const Fraction& _f) c'tor in file durationtype.cpp, which seems unable to create a TDuration out of any fraction whose numerator is not a either 2^n or 3 or 7.

5/4 does indeed generate a TDuration with a _val = V_INVALID, from which ChangeChordRestLen::flip() (file undo.cpp) assigns to the ChordRest (Rest in our case) a duration 0/0. Whence the crash.

The whole process is started by line 1642 - 1651 of Measure::adjustToLen(Fraction nf) (file measure.cpp). I think this is the point to fix, possibly by changing the call(s) to
    score()->undo(new ChangeChordRestDuration(rest, <some_timesig>));
into
    score()->undo(new ChangeChordRestDuration(rest, <a_whole_measure_duration>));

I'll see if I can arrive at a pull request.

M.

What's strange is that this doesn't work on my work unit (Win8.1 64-bit, Qt 5.2.0), tested with 3/4, 4/4 or 5/4, but works OK at home (Win8.1 64-bit, Qt 5.2.0). Changing a 5/4 measure definitely fails.

It depends on the time signature of the measure you start with and on the resulting measure actual duration.

Anyway, a PR is pending which should fix the issue.

M.

Perhaps ironically, this was the bug in 1.3 that prompted me to download the nightly. I guess I shall await the merging of the PR. ..