[trunk] Crash when changing triplet duration after insertion

• Jan 27, 2012 - 14:15
Type
Functional
Severity
S2 - Critical
Status
closed
Project

R5253, Windows XP.

Open the enclosed score. Add more triplets so it looks like this:
tt5.png .

Then try to change the second (original) 1/8 triplet (the one in the middle) to a 1/16. Bang!

Attachment Size
tt5.png 9.06 KB
bug 2.mscx 26.23 KB

Comments

Confirmed - thanks.

It happens if you click any value lower than a quaver.

Using MuseScore 2.0 Nightly Build (5259) - Mac 10.6.8.

Status (old) active patch (code needs review)

I'd like to get the ball rolling on this.

The enclosed patch fixes the crash.

With this change, the note is correctly changed, a rest inserted and the following note is drawn with the correct hook.
NOT FOUND: 02

Sadly, upon undo it falls apart and doesn't draw correctly any more:
NOT FOUND: 03

Further analysis:
The problem after undo has to do with the fact that the beam isn't drawn correctly. In beam.cpp:1153 it tries to extend the stem to the beam, but since there is no beam, it draws the stem to Y=+/- 1000000. Here is the code:

qreal y = chordUp ? 1000000.0 : -1000000;
// extend stem to farest beam segment
qreal x = x2 - parent()->pagePos().x();
foreach(QLineF* l, beamSegments) {
if ((l->x1() <= x) && (l->x2() > x)) {
qreal dx = x - l->x1();

If the loop is empty, like in this case, so no beams, then the inital y value of +/- 1000000 is used.

Please let me know what you think.

Attachment Size
chord.cpp_.patch 844 bytes
14668-1.png 7.34 KB
14668-2.png 6.56 KB

I had something similar just now. I had tried to create a triplet (wanted it to replace a quarter note, but it
was set to replaced an eighth). I couldn't figure out how to delete the eighth triplet, so I ended up deleting the measure to rewrite it. In the blank measure, I set note to quarter, then pressed Ctrl-3 and it crashed. (see attached)

Attachment Size
Capture_Muse.PNG 143.84 KB

Chen Lung: I had to use Task Manager to kill the process when it crashed; the application wouldn't close normally. But it reopened fine without a reboot, and it opened with the work file intact. I have not had the crash again (but I'm not doing much else right now with triplets either).

Machine: Win7 x64
MuseScore 1.1 Rev 4611

Status (old) patch (code needs review) fixed

- the hook is created in layoutStem1(), layoutStem() should not create a hook. The bug is that layoutStem() should only layout a hook if there is one
- undo did not work bc. the chords/rests in beam->_elements have to be sorted by tick. Fix is to change Beam->add() to ensure this.

fixed in r5272