Crash when changing measure duration in part

• Jul 26, 2018 - 14:13
Reported version
S2 - Critical


  1. Open score with parts
  2. Switch to a part
  3. Right-click into measure, select measure properties
  4. Change actual duration

Result: crash, stack trace:

1 std::_Rb_tree, std::_Select1st>, std::less, std::allocator>>::_M_begin stl_tree.h 524 0xcf0cec
2 std::_Rb_tree, std::_Select1st>, std::less, std::allocator>>::upper_bound stl_tree.h 939 0xcf0bd4
3 std::map::upper_bound stl_map.h 937 0xce8295
4 Ms::Staff::timeSig staff.cpp 327 0x815544
5 Ms::Staff::timeStretch staff.cpp 316 0x8154e3
6 Ms::Measure::adjustToLen measure.cpp 1624 0x8031bc
7 Ms::MeasureProperties::apply measureproperties.cpp 264 0x4e17cc
8 Ms::MeasureProperties::bboxClicked measureproperties.cpp 177 0x4e1260
9 Ms::MeasureProperties::qt_static_metacall moc_measureproperties.cpp 78 0x6bbed8
10 ZN11QMetaObject8activateEP7QObjectiiPPv 0x68a655a2
11 ZNK16QDialogButtonBox6buttonENS_14StandardButtonE 0x1d428ef0
12 ?? 0x26ddddb0
13 ?? 0x185598b4

Confirmed in 2.2.1, 2.3.1 and today's 2.3.2, not an issue in 2.0-2.1, not yet checked in master


This issue occurs on May 2017.

  • The 2.1 works (released on May 2, 2017)

  • But crash a few weeks after, ie May 23 with: 2c0b435

There is a dozen of commits between them. Must be checked, but I see one commit related to time signature and actual duration (on May 6).
Maybe an unexpected effect of?…
To fix: #189741: Corruption on operations involving measures with local time signature and modified actual duration

  • For the record, this issue doesn't exist when creating part for a single instrument (eg treble clef or grand staff templates)
    Two parts/instruments are needed, or more (SATB etc.)

  • No issue with the current master 3.0 dev.

And indeed the 1st line of that commit is where the crash happens.
At least that line (1609, moved further down to 1624 due to later changes I guess) is part of the stack trace:
6 Ms::Measure::adjustToLen measure.cpp 1624 0x8031bc)

I guess probably we have the wrong staffIdx at this point - it's relative to the score, not the part. So score()->staff(staffIdx) is probably returning null. Should be an easy fix if so, will look.