LMMS / LMMS/lmms

Segmentation fault when instruments are connected through MIDI inputs/outputs

Open
#6,682 6 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

OS: GNU/Linux
Distribution: Manjaro

### Bug Summary

Crash (segfault) related to instruments that are connected through MIDI inputs/outputs.

#### Steps to reproduce

1. Put two instruments in Song Editor.
2. Enable MIDI output in the first instrument
3. Enable MIDI input in the second instrument
4. Connect second instrument to the first one (through MIDI input, `128:0 LMMS:first`)
5. Put a clip in first instrument track and put single note in it
6. Press and hold Space in Song Editor to play/stop repeatedly

#### Expected behavior

No crash.

#### Actual behavior

Crash, segmentation fault.

#### Screenshot

![image](https://github.com/LMMS/lmms/assets/69623172/cbe3e4d7-381d-4abf-ac6f-9b4067a4392b)

#### Affected LMMS versions (versions in which crash happens)

`LMMS 1.3.0-alpha.1.278+gfb529a19c` (master) (logs are from this version)
`LMMS 1.2.2` (appimage)
`LMMS 1.3.0-alpha.1.102+g89fc6c9` (appimage)

#### Logs

```
Thread 18 "lmms::MidiAlsaS" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fff7ffff6c0 (LWP 172705)]
0x00005555557d6e35 in lmms::NotePlayHandle::noteOff (this=0x0, _s=0) at /home/user/lmms/src/core/NotePlayHandle.cpp:371
371 if( m_released )
```

```
(gdb) backtrace
#0 0x00005555557d6e35 in lmms::NotePlayHandle::noteOff(int)
(this=0x0, _s=0)
at /home/user/lmms/src/core/NotePlayHandle.cpp:371
#1 0x000055555595a460 in lmms::InstrumentTrack::processInEvent(lmms::MidiEvent const&, lmms::TimePos const&, int)
(this=0x7ffff27c9680, event=..., time=..., offset=0)
at /home/user/lmms/src/tracks/InstrumentTrack.cpp:363
#2 0x000055555583818f in lmms::MidiPort::processInEvent(lmms::MidiEvent const&, lmms::TimePos const&)
(this=0x7ffff27c9888, event=..., time=...)
at /home/user/lmms/src/core/midi/MidiPort.cpp:151
#3 0x00005555558315bb in lmms::MidiAlsaSeq::run()
(this=0x5555565829f0)
at /home/user/lmms/src/core/midi/MidiAlsaSeq.cpp:543
#4 0x00007ffff64ff32a in () at /usr/lib/libQt5Core.so.5
#5 0x00007ffff5f788fd in () at /usr/lib/libc.so.6
#6 0x00007ffff5ffaa60 in () at /usr/lib/libc.so.6
```

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 using the listed MIDI input/output steps, then start with src/core/NotePlayHandle.cpp:371 and follow the call chain through src/tracks/InstrumentTrack.cpp:363, src/core/midi/MidiPort.cpp:151, and src/core/midi/MidiAlsaSeq.cpp:543. Use the provided backtrace to investigate the null NotePlayHandle; done means repeated playback with the connected instruments no longer segfaults.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.