Adding fixed spacer can clash with vertical frame below, causing a crash.

• Apr 9, 2020 - 10:50
Reported version
3.4
Type
Functional
Frequency
Once
Severity
S2 - Critical
Reproducibility
Always
Status
closed
Regression
No
Workaround
No
Project
  1. Create an 8-measure piano score.
  2. Add a system break at bar 4 to create two systems.
  3. Add a vertical frame to the lower system (top staff).
  4. Select measure 1 (lower staff) and apply a fixed spacer.
    Crash.

Works if you add a Spacer Down instead of a fixed spacer.
Or, by adding a fixed spacer, but in the top staff (not lower staff) - in second system measure 5.

Attachment Size
frame spacer test.mscz 4.38 KB

Comments

Confirmed, in latest master code too. Famous last words (debug output):

Fatal: staffY: staves 0: bad staffIdx 0 (...\libmscore\system.cpp:1106, qreal Ms::System::staffYpage(int) const)

Code:

qreal System::staffYpage(int staffIdx) const
      {
      if (_staves.size() <= staffIdx || staffIdx < 0) {
            qFatal("staffY: staves %d: bad staffIdx %d", _staves.size(), staffIdx);
            return pagePos().y();
            }
      return _staves[staffIdx]->y() + y();
      }

Stack trace just prior to that qFatal():
1 Ms::System::staffYpage system.cpp 1106 0xa1e69c
2 Ms::Measure::drop measure.cpp 1550 0x95eb98
3 Ms::applyDrop palette.cpp 469 0x7284c7
4 Ms::Palette::applyPaletteElement palette.cpp 604 0x7292e8
5 Ms::UserPaletteController::applyPaletteElement paletteworkspace.cpp 579 0x5c55e3
6 Ms::AbstractPaletteController::qt_static_metacall moc_paletteworkspace.cpp 286 0x637041
7 Ms::AbstractPaletteController::qt_metacall moc_paletteworkspace.cpp 338 0x63722e
8 Ms::UserPaletteController::qt_metacall moc_paletteworkspace.cpp 431 0x6373bf
9 QQmlMetaObject::propertyCache(QQmlEnginePrivate *) const 0x6623871b
10 QV4::QObjectWrapper::virtualResolveLookupGetter(QV4::Object const *, QV4::ExecutionEngine *, QV4::Lookup *) 0x661a4dc7
11 QV4::QObjectWrapper::virtualResolveLookupGetter(QV4::Object const *, QV4::ExecutionEngine *, QV4::Lookup *) 0x661a64fd
12 QV4::QObjectMethod::callInternal(QV4::Value const *, QV4::Value const *, int) const 0x661a710b
13 qt_v4TriggeredBreakpointHook 0x661b6f9f
14 qt_v4DebuggerHook 0x661ba316
15 QV4::Function::call(QV4::Value const *, QV4::Value const *, int, QV4::ExecutionContext const *) 0x6615f952
16 QQmlJavaScriptExpression::evaluate(QV4::CallData *, bool *) 0x6625386c
17 QQmlBoundSignalExpression::evaluate(void * *) 0x6621495d
18 QQmlBoundSignalExpression::QQmlBoundSignalExpression(QObject *, int, QQmlContextData *, QObject *, QString const&, QString const&, unsigned short, unsigned short, QString const&, QString const&) 0x66215ccc
19 QQmlNotifier::emitNotify(QQmlNotifierEndpoint *, void * *) 0x6623dee2
20 QQmlData::signalEmitted(QAbstractDeclarativeData *, QObject *, int, void * *) 0x661fffc5
21 QMetaObject::activate(QObject *, int, int, void * *) 0x68a94093
22 QQuickMouseArea::setPressed(Qt::MouseButton, bool, Qt::MouseEventSource) 0x6e6f1881
23 QQuickMouseArea::mouseReleaseEvent(QMouseEvent *) 0x6e6f2e21
24 QQuickItem::event(QEvent *) 0x6e6946b8
25 QApplicationPrivate::notify_helper(QObject *, QEvent *) 0x2a207bdc
26 QApplication::notify(QObject *, QEvent *) 0x2a20ec23
27 QCoreApplication::sendEvent(QObject *, QEvent *) 0x68a692e8
28 QQuickWindowPrivate::deliverMouseEvent(QQuickPointerMouseEvent *) 0x6e6ab5e9
29 QQuickWindowPrivate::deliverPointerEvent(QQuickPointerEvent *) 0x6e6ac99e
30 QQuickWindowPrivate::handleMouseEvent(QMouseEvent *) 0x6e6ad550
31 QWindow::event(QEvent *) 0x619834a5
32 QQuickWindow::event(QEvent *) 0x6e6ae826
33 QApplicationPrivate::notify_helper(QObject *, QEvent *) 0x2a207bdc
34 QApplication::notify(QObject *, QEvent *) 0x2a20ec23
35 QCoreApplication::sendSpontaneousEvent(QObject *, QEvent *) 0x68a694a8
36 QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent *) 0x61976e54
37 QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *) 0x619781c5
38 QWindowSystemInterface::sendWindowSystemEvents(QFlags) 0x61950e7c
39 QEventDispatcherWin32Private::sendTimerEvent(int) 0x68ac3cda
40 USER32!TranslateMessageEx 0x77789861
41 USER32!TranslateMessage 0x77789572
42 QEventDispatcherWin32::processEvents(QFlags) 0x68ac317b
43 qwindows!qt_plugin_instance 0x6a8fc985
44 QEventLoop::exec(QFlags) 0x68a6748f
45 QCoreApplication::exec() 0x68a70707
46 Ms::runApplication musescore.cpp 7720 0x43e9f3
47 main main.cpp 92 0x401687

Even funnier: uncommenting that qFatal() and MuseScore just works and adds that spacer!
I wonder whether we could just change it into a qWarning() or qDebug()?

Not sure it is really fixed though, the 1st commit of my PR resolves the crash, but the 2nd make it crash on a failed assertion again, at least in a non-Release build.
Time may tell...

Fix version
3.5.0