Skip to content

Commit

Permalink
Release m_data pointer if in view mode
Browse files Browse the repository at this point in the history
  • Loading branch information
gvnnz committed Mar 31, 2024
1 parent d361e8b commit 047e469
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/audioBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ AudioBuffer::AudioBuffer(AudioBuffer&& o) noexcept

AudioBuffer::~AudioBuffer()
{
if (!m_viewing)
free();
free();
}

/* -------------------------------------------------------------------------- */
Expand Down Expand Up @@ -155,7 +154,11 @@ void AudioBuffer::alloc(int size, int channels)

void AudioBuffer::free()
{
m_data.reset();
if (m_viewing)
m_data.release();
else
m_data.reset();

m_size = 0;
m_channels = 0;
m_viewing = false;
Expand Down

0 comments on commit 047e469

Please sign in to comment.