Crash when adjusting Absolute Velocity in piano roll editor

• Jul 18, 2019 - 03:58
Reported version
3.2
Type
Functional
Frequency
Once
Severity
S4 - Minor
Reproducibility
Always
Status
closed
Regression
No
Workaround
No
Project
  1. Place some notes on the score
  2. Open the Piano Roll editor
  3. Switch the bottom panel to Velocity Absolute
  4. Select some notes
  5. Click on the yellow lines to adjust the velocity (click around a lot!)
  6. Eventually app will crash

---- Partial stack trace:

Crashed Thread: 0 CrBrowserMain Dispatch queue: com.apple.main-thread

Exception Type: EXC_ARITHMETIC (SIGFPE)
Exception Codes: EXC_I386_DIV (divide by zero)
Exception Note: EXC_CORPSE_NOTIFY

Termination Signal: Floating point exception: 8
Termination Reason: Namespace SIGNAL, Code 0x8
Terminating Process: exc handler [12344]

Thread 0 Crashed:: CrBrowserMain Dispatch queue: com.apple.main-thread
0 org.musescore.MuseScore 0x0000000100eb1718 Ms::PianoLevels::adjustLevelLerp(int, int, int, int, bool) + 872
1 org.musescore.MuseScore 0x0000000100eb1fbd Ms::PianoLevels::mouseMoveEvent(QMouseEvent) + 1261
2 org.qt-project.QtWidgets 0x00000001025ce000 QWidget::event(QEvent
) + 544
3 org.qt-project.QtWidgets 0x0000000102593eb2 QApplicationPrivate::notify_helper(QObject*, QEvent) + 306
4 org.qt-project.QtWidgets 0x0000000102596c4d QApplication::notify(QObject
, QEvent) + 7165
5 org.qt-project.QtCore 0x0000000103b32edf QCoreApplication::notifyInternal2(QObject
, QEvent) + 159
6 org.qt-project.QtWidgets 0x00000001025947e0 QApplicationPrivate::sendMouseEvent(QWidget
, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer&, bool) + 896
7 org.qt-project.QtWidgets 0x00000001025ee31c 0x102582000 + 443164
8 org.qt-project.QtWidgets 0x00000001025ecf79 0x102582000 + 438137
9 org.qt-project.QtWidgets 0x0000000102593eb2 QApplicationPrivate::notify_helper(QObject*, QEvent) + 306
10 org.qt-project.QtWidgets 0x00000001025951cf QApplication::notify(QObject
, QEvent) + 383
11 org.qt-project.QtCore 0x0000000103b32edf QCoreApplication::notifyInternal2(QObject
, QEvent) + 159
12 org.qt-project.QtGui 0x0000000102f1f0a2 QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent
) + 2962
13 org.qt-project.QtGui 0x0000000102f051db QWindowSystemInterface::sendWindowSystemEvents(QFlags) + 155


Comments

Status active PR created

I have not been able to reproduce the crash, but thanks to your stack trace, I believe I know what the problem is and how to fix it. The cause of the crash is a divide-by-zero exception in Ms::PianoLevels::adjustLevelLerp(int, int, int, int, bool). Presumably, this occurs on line 419 in the case where tick0 is equal to tick1. On lines 408 and 409 a similar calculation is made, but only if tick0 is not equal to tick1. Line 419 should probably be modified to match lines 408 and 409. See https://github.com/musescore/MuseScore/pull/5233 for a pull request that does just that.

Fix version
3.3.0