mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 14:54:56 +01:00
Allow to re-allocate (ensure) buffers after clearing them
This fixes a crash when removing and re-adding regionFX. Removing all FX clears the _readcache BufferSet (see AudioRegion::remove_plugin). BufferSet::clear() calls _buffers.clear(); leading to a assert/crash when adding a new regionFX plugin which calls BufferSet::ensure_buffers.
This commit is contained in:
parent
afd0172c63
commit
e539cabc00
1 changed files with 9 additions and 1 deletions
|
|
@ -155,12 +155,20 @@ void
|
|||
BufferSet::ensure_buffers(DataType type, size_t num_buffers, size_t buffer_capacity)
|
||||
{
|
||||
assert(type != DataType::NIL);
|
||||
assert(type < _buffers.size());
|
||||
assert(type < _buffers.capacity());
|
||||
|
||||
if (num_buffers == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* after a clear (), re-initlaize buffers */
|
||||
if (_buffers.empty ()) {
|
||||
for (size_t i=0; i < DataType::num_types; ++i) {
|
||||
_buffers.push_back(BufferVec());
|
||||
}
|
||||
}
|
||||
assert(_buffers.size() == DataType::num_types);
|
||||
|
||||
// The vector of buffers of the type we care about
|
||||
BufferVec& bufs = _buffers[type];
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue