mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 03:50:11 +02:00
Only call ftruncate() when size > 0
Either Boost or Linux really doesn't like it if you ftruncate() shared memory down to 0 bytes.
This commit is contained in:
+4
-2
@@ -10,12 +10,14 @@ Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed a regression from yabridge 3.4.0 where plugins with zero audio channels
|
||||
would result in a crash.
|
||||
- Fixed a regression from yabridge 3.4.0 where JUCE-based VST3 plugins might
|
||||
cause **Ardour** or **Mixbus** to freeze in very specific circumstances.
|
||||
- Worked around a **REAPER** bug that would cause REAPER to not process any
|
||||
keyboard input when the FX window is active but the mouse is outside of the
|
||||
window. We now use the same validation used in `xprop` and `xwininfo` to find
|
||||
the host's window instead of always taking the topmost window.
|
||||
- Fixed a regression from yabridge 3.4.0 where JUCE-based VST3 plugins might
|
||||
cause **Ardour** or **Mixbus** to freeze.
|
||||
|
||||
## [3.4.0] - 2021-07-15
|
||||
|
||||
|
||||
@@ -21,10 +21,14 @@ AudioShmBuffer::AudioShmBuffer(const Config& config)
|
||||
shm(boost::interprocess::open_or_create,
|
||||
config.name.c_str(),
|
||||
boost::interprocess::read_write) {
|
||||
shm.truncate(config.size);
|
||||
buffer =
|
||||
boost::interprocess::mapped_region(shm, boost::interprocess::read_write,
|
||||
0, config.size, nullptr, MAP_LOCKED);
|
||||
// Apparently you get a `Resource temporarily unavailable` when calling
|
||||
// `ftruncate()` with a size of 0 on shared memory
|
||||
if (config.size > 0) {
|
||||
shm.truncate(config.size);
|
||||
buffer = boost::interprocess::mapped_region(
|
||||
shm, boost::interprocess::read_write, 0, config.size, nullptr,
|
||||
MAP_LOCKED);
|
||||
}
|
||||
}
|
||||
|
||||
AudioShmBuffer::~AudioShmBuffer() noexcept {
|
||||
@@ -44,10 +48,12 @@ void AudioShmBuffer::resize(const Config& new_config) {
|
||||
}
|
||||
|
||||
config = new_config;
|
||||
shm.truncate(config.size);
|
||||
buffer =
|
||||
boost::interprocess::mapped_region(shm, boost::interprocess::read_write,
|
||||
0, config.size, nullptr, MAP_LOCKED);
|
||||
if (config.size > 0) {
|
||||
shm.truncate(config.size);
|
||||
buffer = boost::interprocess::mapped_region(
|
||||
shm, boost::interprocess::read_write, 0, config.size, nullptr,
|
||||
MAP_LOCKED);
|
||||
}
|
||||
}
|
||||
|
||||
AudioShmBuffer::AudioShmBuffer(AudioShmBuffer&& o) noexcept
|
||||
|
||||
Reference in New Issue
Block a user