summaryrefslogtreecommitdiffstats
path: root/services/audioflinger
diff options
context:
space:
mode:
authorGlenn Kasten <gkasten@google.com>2012-01-25 15:27:15 -0800
committerGlenn Kasten <gkasten@google.com>2012-02-08 09:49:14 -0800
commitf31d05007c9cc5db90e0641e4f8621f5463dcb4e (patch)
tree020e29860f00eb8d04baa5ba13a442739f937fdc /services/audioflinger
parentc722ba33dd1225cd26d9d758e08234a1bb8f4864 (diff)
downloadframeworks_base-f31d05007c9cc5db90e0641e4f8621f5463dcb4e.zip
frameworks_base-f31d05007c9cc5db90e0641e4f8621f5463dcb4e.tar.gz
frameworks_base-f31d05007c9cc5db90e0641e4f8621f5463dcb4e.tar.bz2
Simplify destructors
Remove explicit clear() when the order doesn't matter. Change-Id: I5931bc7ef5f681c7ce329aa9ec0a6e46d34a56c5
Diffstat (limited to 'services/audioflinger')
-rw-r--r--services/audioflinger/AudioFlinger.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index 43b7245..70fb808 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -245,7 +245,6 @@ AudioFlinger::~AudioFlinger()
audio_hw_device_t *dev = mAudioHwDevs[i];
audio_hw_device_close(dev);
}
- mAudioHwDevs.clear();
}
audio_hw_device_t* AudioFlinger::findSuitableHwDev_l(uint32_t devices)
@@ -2982,7 +2981,6 @@ AudioFlinger::DuplicatingThread::~DuplicatingThread()
for (size_t i = 0; i < mOutputTracks.size(); i++) {
mOutputTracks[i]->destroy();
}
- mOutputTracks.clear();
}
bool AudioFlinger::DuplicatingThread::threadLoop()
@@ -3297,7 +3295,7 @@ AudioFlinger::ThreadBase::TrackBase::~TrackBase()
mCblk->~audio_track_cblk_t(); // destroy our shared-structure.
}
}
- mCblkMemory.clear(); // and free the shared memory
+ mCblkMemory.clear(); // free the shared memory before releasing the heap it belongs to
if (mClient != 0) {
// Client destructor must run with AudioFlinger mutex locked
Mutex::Autolock _l(mClient->audioFlinger()->mLock);
@@ -6919,7 +6917,7 @@ void AudioFlinger::EffectHandle::disconnect(bool unpiniflast)
// unlike ~TrackBase(), mCblk is never a local new, so don't delete
mCblk->~effect_param_cblk_t(); // destroy our shared-structure.
}
- mCblkMemory.clear(); // and free the shared memory
+ mCblkMemory.clear(); // free the shared memory before releasing the heap it belongs to
Mutex::Autolock _l(mClient->audioFlinger()->mLock);
mClient.clear();
}