Crash when inserting a horizontal frame before an initial MM rest

• Dec 9, 2013 - 11:41
Type
Functional
Severity
S2 - Critical
Status
closed
Project

Steps:

  1. Create a new score.
  2. Insert a note in the fourth measure.
  3. Style -> General... check "Create multi measure rests", then OK.
  4. Select the initial multi-measure rest measure.
  5. Add -> Frames -> Insert Horizontal Frame. -> Crash

Alternatively, open attached file created in MuseScore 1.3.

Windows 8, commit df88833 (self-compiled).

The crash happens only if multimeasure rest is checked. It happens inside function removeGeneratedElements at line 1627 of layout.cpp, since there is no previous measure (and thus pm is 0). It seems that the check s->firstMeasure() != m is not working properly in this case.

(Part of) Back-trace:
Program received signal SIGSEGV, Segmentation fault.
0x00a6a100 in Ms::SegmentList::first (this=0xbc) at C:/Git_packages/MuseScore/libmscore/segmentlist.h:40
40 Segment* first() const { return _first; }
(gdb) bt full 7
#0 0x00a6a100 in Ms::SegmentList::first (this=0xbc) at C:/Git_packages/MuseScore/libmscore/segmentlist.h:40
No locals.
#1 0x00a6ffa8 in Ms::Measure::first (this=0x0) at C:/Git_packages/MuseScore/libmscore/measure.h:195
No locals.
#2 0x00651137 in Ms::Measure::findSegment (this=0x0, st=Ms::Segment::SegClef, t=0)
at C:\Git_packages\MuseScore\libmscore\measure.cpp:751
s = 0x26660fcc
#3 0x006511e6 in Ms::Measure::undoGetSegment (this=0x0, type=Ms::Segment::SegClef, tick=0)
at C:\Git_packages\MuseScore\libmscore\measure.cpp:767
s = 0x0
#4 0x0069d701 in Ms::Score::removeGeneratedElements (this=0x21398f60, sm=0x25f203d8, em=0x25f20510)
at C:\Git_packages\MuseScore\libmscore\layout.cpp:1627
pm = 0x0
s = 0x28b668
nc = 0x28b65c
clef = 0x2678e5f8
s = 0x21465280
small = true
el = 0x2678e5f8
staffIdx = 0
st = Ms::Segment::SegClef
seg = 0x266c4d28
m = 0x25f203d8
#5 0x0069c85c in Ms::Score::layoutSystem (this=0x21398f60, minWidth=@0x28b850: 268.80000000000001,
w=718.11023622047253, isFirstSystem=true, longName=true) at C:\Git_packages\MuseScore\libmscore\layout.cpp:1395
isFirstMeasure = false
firstMeasure = 0x25f203d8
measureSpacing = 1.2
systemWidth = 718.11023622047253
continueFlag = false
n = 3
system = 0x21465280
xo = 33.333333333333336
minMeasureWidth = 33.333333333333336
lastMeasure = 0x25f20510
#6 0x0069dffb in Ms::Score::layoutSystemRow (this=0x21398f60, rowWidth=718.11023622047253, isFirstSystem=true,
useLongName=true) at C:\Git_packages\MuseScore\libmscore\layout.cpp:1837
a = true
sl = {{p = {static shared_null = <optimized out>, d = 0x68ab7d84 <ZN9QListData11shared_nullE>},
d = 0x68ab7d84 <ZN9QListData11shared_nullE>}}
ww = 718.11023622047253
minWidth = 268.80000000000001
rest = 1.6054124903941868e+196
raggedRight = false
needRelayout = 57
totalWeight = 1.0463676961420213e-123
xx = 2.1240736670418862e-314
y = 7.9515969543729279e-306
(More stack frames follow...)


Comments

Status (old) active patch (code needs review)

Since the view mode has changed "underneath its feet", it doesn't work to compare a pointed to the first bar in the new mode (multi-bar rests) to a bar in the old mode.

Pull request has been made.