mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-10 04:30:12 +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
|
||||||
|
|
||||||
|
- 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
|
- 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
|
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
|
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.
|
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
|
## [3.4.0] - 2021-07-15
|
||||||
|
|
||||||
|
|||||||
@@ -21,10 +21,14 @@ AudioShmBuffer::AudioShmBuffer(const Config& config)
|
|||||||
shm(boost::interprocess::open_or_create,
|
shm(boost::interprocess::open_or_create,
|
||||||
config.name.c_str(),
|
config.name.c_str(),
|
||||||
boost::interprocess::read_write) {
|
boost::interprocess::read_write) {
|
||||||
shm.truncate(config.size);
|
// Apparently you get a `Resource temporarily unavailable` when calling
|
||||||
buffer =
|
// `ftruncate()` with a size of 0 on shared memory
|
||||||
boost::interprocess::mapped_region(shm, boost::interprocess::read_write,
|
if (config.size > 0) {
|
||||||
0, config.size, nullptr, MAP_LOCKED);
|
shm.truncate(config.size);
|
||||||
|
buffer = boost::interprocess::mapped_region(
|
||||||
|
shm, boost::interprocess::read_write, 0, config.size, nullptr,
|
||||||
|
MAP_LOCKED);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioShmBuffer::~AudioShmBuffer() noexcept {
|
AudioShmBuffer::~AudioShmBuffer() noexcept {
|
||||||
@@ -44,10 +48,12 @@ void AudioShmBuffer::resize(const Config& new_config) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
config = new_config;
|
config = new_config;
|
||||||
shm.truncate(config.size);
|
if (config.size > 0) {
|
||||||
buffer =
|
shm.truncate(config.size);
|
||||||
boost::interprocess::mapped_region(shm, boost::interprocess::read_write,
|
buffer = boost::interprocess::mapped_region(
|
||||||
0, config.size, nullptr, MAP_LOCKED);
|
shm, boost::interprocess::read_write, 0, config.size, nullptr,
|
||||||
|
MAP_LOCKED);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
AudioShmBuffer::AudioShmBuffer(AudioShmBuffer&& o) noexcept
|
AudioShmBuffer::AudioShmBuffer(AudioShmBuffer&& o) noexcept
|
||||||
|
|||||||
Reference in New Issue
Block a user