Skip to content

Conversation

JohannesLorenz
Copy link
Contributor

@JohannesLorenz JohannesLorenz commented Apr 13, 2020

Fixes #5408

Info for testers:

  • You need to have both JackAudio and JackMidi enabled in the settings to test this PR (restart required after changing settings).
  • I already tested that the warnings from valgrind are gone now, but if someone who uses JackMidi can confirm that it still works as usual, that would be nice.

@LmmsBot
Copy link

LmmsBot commented Apr 13, 2020

🤖 Hey, I'm @LmmsBot from github.com/lmms/bot and I made downloads for this pull request, click me to make them magically appear! 🎩

Windows

🤖
{"platform_name_to_artifacts": {"Windows": [{"artifact": {"title": {"title": "32-bit", "platform_name": "Windows"}, "link": {"link": "https://ci.appveyor.com/api/buildjobs/6xi82qkh2lvbsbmr/artifacts/build/lmms-1.2.1-msvc2017-win32.exe"}}, "build_link": "https://ci.appveyor.com/project/Lukas-W/lmms/builds/32281936"}, {"artifact": {"title": {"title": "64-bit", "platform_name": "Windows"}, "link": {"link": "https://ci.appveyor.com/api/buildjobs/udvouh4uhc0u4eh8/artifacts/build/lmms-1.2.1-msvc2017-win64.exe"}}, "build_link": "https://ci.appveyor.com/project/Lukas-W/lmms/builds/32281936"}]}, "commit_sha": "3a0a14514da26076d1fd7d477013a16cfca25277"}

This fixes reading from jack MIDI events in case where
there are no jack MIDI events.
This patch
* makes `m_stopped` atomic
* initializes `m_stopped` correctly to `true`
* moves the initialization of `m_stopped` to the point where jack ports
  are already connected
This atomically unsets the MidiJack reference in AudioJack right before
MidiJack is destroyed. This avoids AudioJack using a destroyed MidiJack
object.
Warning is:

```
jack_port_unregister called with an incorrect port 0
Failed to unregister jack midi output
```
@JohannesLorenz JohannesLorenz changed the title Fix uninitialized value read Audio/MidiJack: Fix invalid reads Apr 19, 2020
@PhysSong PhysSong marked this pull request as ready for review April 21, 2020 00:39
@JohannesLorenz JohannesLorenz added needs code review A functional code review is currently required for this PR needs style review A style review is currently required for this PR needs testing This pull request needs more testing labels Apr 23, 2020
@PhysSong PhysSong changed the base branch from master to stable-1.2 April 23, 2020 10:09
@JohannesLorenz
Copy link
Contributor Author

JohannesLorenz commented Apr 23, 2020

Thanks to @Spekular for functional and style checks. Now it's time for testing (see notes in the original post).

@JohannesLorenz JohannesLorenz removed needs code review A functional code review is currently required for this PR needs style review A style review is currently required for this PR labels Apr 23, 2020
@JohannesLorenz
Copy link
Contributor Author

Tested. JackMidi still works. Merge Time!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs testing This pull request needs more testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

JackAudio + JackMidi cause invalid and uninitialized reads
3 participants