From 438978b8559620918eff9b721491560780f97bac Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Tue, 10 Feb 2015 19:25:12 +0100 Subject: [PATCH 1/2] Fix reverb memory leak --- libraries/audio-client/src/AudioClient.cpp | 16 ++++++++++++++++ libraries/audio-client/src/AudioClient.h | 1 + 2 files changed, 17 insertions(+) diff --git a/libraries/audio-client/src/AudioClient.cpp b/libraries/audio-client/src/AudioClient.cpp index 9f569c9893..7f6c509626 100644 --- a/libraries/audio-client/src/AudioClient.cpp +++ b/libraries/audio-client/src/AudioClient.cpp @@ -135,6 +135,15 @@ AudioClient::AudioClient() : updateTimer->start(DEVICE_CHECK_INTERVAL_MSECS); } +AudioClient::~AudioClient() { + if (_gverbLocal) { + gverb_free(_gverbLocal); + } + if (_gverb) { + gverb_free(_gverb); + } +} + void AudioClient::reset() { _receivedAudioStream.reset(); _stats.reset(); @@ -522,10 +531,17 @@ bool AudioClient::switchOutputToAudioDevice(const QString& outputDeviceName) { void AudioClient::initGverb() { // Initialize a new gverb instance + if (_gverbLocal) { + gverb_free(_gverbLocal); + } _gverbLocal = gverb_new(_outputFormat.sampleRate(), _reverbOptions->getMaxRoomSize(), _reverbOptions->getRoomSize(), _reverbOptions->getReverbTime(), _reverbOptions->getDamping(), _reverbOptions->getSpread(), _reverbOptions->getInputBandwidth(), _reverbOptions->getEarlyLevel(), _reverbOptions->getTailLevel()); + + if (_gverb) { + gverb_free(_gverb); + } _gverb = gverb_new(_outputFormat.sampleRate(), _reverbOptions->getMaxRoomSize(), _reverbOptions->getRoomSize(), _reverbOptions->getReverbTime(), _reverbOptions->getDamping(), _reverbOptions->getSpread(), _reverbOptions->getInputBandwidth(), _reverbOptions->getEarlyLevel(), diff --git a/libraries/audio-client/src/AudioClient.h b/libraries/audio-client/src/AudioClient.h index ed487e4ea1..e55a116e06 100644 --- a/libraries/audio-client/src/AudioClient.h +++ b/libraries/audio-client/src/AudioClient.h @@ -186,6 +186,7 @@ signals: protected: AudioClient(); + ~AudioClient(); private: void outputFormatChanged(); From 562b289c0541f98e877381d7f45000244cca3216 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Tue, 10 Feb 2015 19:25:38 +0100 Subject: [PATCH 2/2] Fix warning --- libraries/fbx/src/FBXReader.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/libraries/fbx/src/FBXReader.cpp b/libraries/fbx/src/FBXReader.cpp index 1da0a7e09f..043bd43115 100644 --- a/libraries/fbx/src/FBXReader.cpp +++ b/libraries/fbx/src/FBXReader.cpp @@ -1166,7 +1166,6 @@ int matchTextureUVSetToAttributeChannel(const QString& texUVSetName, const QHash FBXLight extractLight(const FBXNode& object) { FBXLight light; - int unkwnon = 0; foreach (const FBXNode& subobject, object.children) { QString childname = QString(subobject.name); if (subobject.name == "Properties70") {