From 047e4698f034a9c13ddc7c6afdbee0ae5b1e7ada Mon Sep 17 00:00:00 2001 From: gvnnz Date: Sun, 31 Mar 2024 21:25:34 +0200 Subject: [PATCH] Release m_data pointer if in view mode --- src/audioBuffer.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/audioBuffer.cpp b/src/audioBuffer.cpp index 1692271..c42b4fe 100644 --- a/src/audioBuffer.cpp +++ b/src/audioBuffer.cpp @@ -75,8 +75,7 @@ AudioBuffer::AudioBuffer(AudioBuffer&& o) noexcept AudioBuffer::~AudioBuffer() { - if (!m_viewing) - free(); + free(); } /* -------------------------------------------------------------------------- */ @@ -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;