mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-11 23:54:18 +00:00
Fix for an AudioBuffer move operator bug
This commit is contained in:
parent
7c6f3d40b6
commit
1cc371cae9
1 changed files with 21 additions and 4 deletions
|
|
@ -184,11 +184,19 @@ public:
|
|||
: numChannels (other.numChannels),
|
||||
size (other.size),
|
||||
allocatedBytes (other.allocatedBytes),
|
||||
channels (numChannels < (int) numElementsInArray (preallocatedChannelSpace) ? preallocatedChannelSpace : other.channels),
|
||||
allocatedData (static_cast<HeapBlock<char, true>&&> (other.allocatedData)),
|
||||
isClear (other.isClear)
|
||||
{
|
||||
memcpy (preallocatedChannelSpace, other.preallocatedChannelSpace, sizeof (preallocatedChannelSpace));
|
||||
if (numChannels < (int) numElementsInArray (preallocatedChannelSpace))
|
||||
{
|
||||
channels = preallocatedChannelSpace;
|
||||
memcpy (preallocatedChannelSpace, other.channels, sizeof (preallocatedChannelSpace));
|
||||
}
|
||||
else
|
||||
{
|
||||
channels = other.channels;
|
||||
}
|
||||
|
||||
other.numChannels = 0;
|
||||
other.size = 0;
|
||||
other.allocatedBytes = 0;
|
||||
|
|
@ -200,10 +208,19 @@ public:
|
|||
numChannels = other.numChannels;
|
||||
size = other.size;
|
||||
allocatedBytes = other.allocatedBytes;
|
||||
channels = numChannels < (int) numElementsInArray (preallocatedChannelSpace) ? preallocatedChannelSpace : other.channels;
|
||||
allocatedData = static_cast<HeapBlock<char, true>&&> (other.allocatedData);
|
||||
isClear = other.isClear;
|
||||
memcpy (preallocatedChannelSpace, other.preallocatedChannelSpace, sizeof (preallocatedChannelSpace));
|
||||
|
||||
if (numChannels < (int) numElementsInArray (preallocatedChannelSpace))
|
||||
{
|
||||
channels = preallocatedChannelSpace;
|
||||
memcpy (preallocatedChannelSpace, other.channels, sizeof (preallocatedChannelSpace));
|
||||
}
|
||||
else
|
||||
{
|
||||
channels = other.channels;
|
||||
}
|
||||
|
||||
other.numChannels = 0;
|
||||
other.size = 0;
|
||||
other.allocatedBytes = 0;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue