LMMS / LMMS/lmms

Crash when replacing an instrument with a controller connected to its pitch

Open
#8,271 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C++
Stars
10.4k
Forks
1.3k
Avg merge
2d 13h
Merged PRs (30d)
7

Description

### System Information

Linux Mint 22.3

### LMMS Version(s)

a8423c1

### Most Recent Working Version

_No response_

### Bug Summary

When replacing an instrument that has a controller connected to its pitch knob, LMMS can sometimes crash (especially when using specific instrument plugins or replacing an instrument multiple times). I also think issues #6630 and #3669 might be related to this since they also relate to replacing instruments and crash while running audio engine functions, but I'm not sure.

### Expected Behaviour

LMMS should still run without freezing and crashing, with it now displaying the new instrument.

### Steps To Reproduce

1. Add any new instrument (I used Nescaline)
2. Add a new controller (can be LFO or Peak)
3. Connect the controller to the Pitch knob in the instrument's properties
4. Drag an instrument from the Instrument Plugins tab (SID was the most consistent) onto the instrument to replace it
5. LMMS should crash (freeze and then close)

### Logs

Click to expand

Thread 23 "AudioEngine::fi" received signal SIGSEGV, Segmentation fault.

gdb Backtrace:

#0  0x00007ffff5e04240 in main_arena () at /lib/x86_64-linux-gnu/libc.so.6

#1 0x0000555555afa151 in lmms::InstrumentTrack::processOutEvent
(this=0x55555eccfd20, event=..., time=..., offset=0)
at /home/jlintgod/Documents/Git_Repos/lmms/src/tracks/InstrumentTrack.cpp:518
transposedEvent = {m_type = lmms::MidiPitchBend, m_metaEvent = lmms::MidiMetaInvalid, m_channel = 0 '\000', m_data = {m_param = {14335, 0}, m_bytes = "\3777\000", m_sysExDataLen = 14335}, m_sysExData = 0x0, m_sourcePort = 0x0, m_source = lmms::MidiEvent::Source::External}
key = 14335
handleEventOutputChannel = 0
#2 0x0000555555afa73d in lmms::InstrumentTrack::updatePitch
(this=0x55555eccfd20)
at /home/jlintgod/Documents/Git_Repos/lmms/src/tracks/InstrumentTrack.cpp:653
#3 0x0000555555808a80 in lmms::InstrumentTrack::qt_static_metacall
(_o=0x55555eccfd20, _c=QMetaObject::InvokeMetaMethod, _id=6, _a=0x7fff9bffe920)
at /home/jlintgod/Documents/Git_Repos/lmms/build/src/lmmsobjs_autogen/DGKZTCOIDE/moc_InstrumentTrack.cpp:111
_t = 0x55555eccfd20
#4 0x00007ffff6d12c0c in ??? () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#5 0x000055555580f33d in lmms::Model::dataChanged (this=0x55555ecd11a0)
--Type for more, q to quit, c to continue without paging--c
at /home/jlintgod/Documents/Git_Repos/lmms/build/src/lmmsobjs_autogen/DGKZTCOIDE/moc_Model.cpp:154
#6 0x000055555580f07b in lmms::Model::qt_static_metacall (_o=0x55555ecd11a0, _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0x7fff9bffea60)
at /home/jlintgod/Documents/Git_Repos/lmms/build/src/lmmsobjs_autogen/DGKZTCOIDE/moc_Model.cpp:79
_t = 0x55555ecd11a0
#7 0x00007ffff6d12c0c in ??? () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#8 0x0000555555803167 in lmms::ControllerConnection::valueChanged (this=0x55555e75d220)
at /home/jlintgod/Documents/Git_Repos/lmms/build/src/lmmsobjs_autogen/DGKZTCOIDE/moc_ControllerConnection.cpp:142
#9 0x0000555555802f67 in lmms::ControllerConnection::qt_static_metacall (_o=0x55555e75d220, _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0x7fff9bffeb90)
at /home/jlintgod/Documents/Git_Repos/lmms/build/src/lmmsobjs_autogen/DGKZTCOIDE/moc_ControllerConnection.cpp:80
_t = 0x55555e75d220
#10 0x00007ffff6d12c0c in ??? () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#11 0x0000555555802f1f in lmms::Controller::valueChanged (this=0x55556008da20) at /home/jlintgod/Documents/Git_Repos/lmms/build/src/lmmsobjs_autogen/DGKZTCOIDE/moc_Controller.cpp:151
#12 0x0000555555862b4d in lmms::Controller::triggerFrameCounter () at /home/jlintgod/Documents/Git_Repos/lmms/src/core/Controller.cpp:165
controller = 0x55556008da20
__for_range = std::vector of length 1, capacity 1 = {0x55556008da20}
__for_begin = 0x55556008da20
__for_end = 0x0
#13 0x00005555558327b9 in lmms::AudioEngine::renderStageMix (this=0x55555655bfe0) at /home/jlintgod/Documents/Git_Repos/lmms/src/core/AudioEngine.cpp:394
profilerProbe = {m_profiler = @0x55555655c0f0, m_type = lmms::AudioEngineProfiler::DetailType::Mixing}
mixer = 0x55555667a5a0
#14 0x00005555558328ad in lmms::AudioEngine::renderNextBuffer (this=0x55555655bfe0) at /home/jlintgod/Documents/Git_Repos/lmms/src/core/AudioEngine.cpp:410
lock = {_M_device = @0x55555655c158}
#15 0x0000555555834e94 in lmms::AudioEngine::fifoWriter::run (this=0x555557225a80) at /home/jlintgod/Documents/Git_Repos/lmms/src/core/AudioEngine.cpp:1083
buffer = 0x7fff90001300
b = 0x5555567833d0
frames = 256
#16 0x00007ffff6adb674 in ??? () at /lib/x86_64-linux-gnu/libQt5Core.so.5
#17 0x00007ffff5c9caa4 in start_thread (arg=) at ./nptl/pthread_create.c:447
ret =
pd =
out =
unwind_buf = {cancel_jmp_buf = {{jmp_buf = {140735810631360, 4796571913880869435, 4294967295, -272, 11, 140737488344592, 4796571913927006779, 4796338904647473723}, mask_was_saved = 0}}, priv = {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, canceltype = 0}}}
not_first_call =
#18 0x00007ffff5d29c6c in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78

### Screenshots / Minimum Reproducible Project

_No response_

### Please search the issue tracker for existing bug reports before submitting your own.

- [x] I have searched all existing issues and confirmed that this is not a duplicate.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the crash with a controller connected to an instrument's Pitch knob, then inspect src/tracks/InstrumentTrack.cpp at processOutEvent and updatePitch. Trace the related calls through src/core/Controller.cpp and src/core/AudioEngine.cpp using the supplied backtrace. Done means replacing the instrument no longer freezes or crashes while the audio engine is running.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
desktop
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.