summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/private/media/AudioTrackShared.h1
-rw-r--r--services/audioflinger/AudioFlinger.cpp6
2 files changed, 5 insertions, 2 deletions
diff --git a/include/private/media/AudioTrackShared.h b/include/private/media/AudioTrackShared.h
index dd97ce4..23226c0 100644
--- a/include/private/media/AudioTrackShared.h
+++ b/include/private/media/AudioTrackShared.h
@@ -54,6 +54,7 @@ namespace android {
#define CBLK_RESTORED_ON 0x0040 // track has been restored after invalidation
#define CBLK_RESTORED_OFF 0x0040 // by AudioFlinger
+// Important: do not add any virtual methods, including ~
struct audio_track_cblk_t
{
diff --git a/services/audioflinger/AudioFlinger.cpp b/services/audioflinger/AudioFlinger.cpp
index f71ba0a..a5894b6 100644
--- a/services/audioflinger/AudioFlinger.cpp
+++ b/services/audioflinger/AudioFlinger.cpp
@@ -3324,9 +3324,10 @@ AudioFlinger::ThreadBase::TrackBase::TrackBase(
AudioFlinger::ThreadBase::TrackBase::~TrackBase()
{
if (mCblk != NULL) {
- mCblk->~audio_track_cblk_t(); // destroy our shared-structure.
- if (mClient == NULL) {
+ if (mClient == 0) {
delete mCblk;
+ } else {
+ mCblk->~audio_track_cblk_t(); // destroy our shared-structure.
}
}
mCblkMemory.clear(); // and free the shared memory
@@ -6970,6 +6971,7 @@ void AudioFlinger::EffectHandle::disconnect(bool unpiniflast)
mEffect.clear();
if (mClient != 0) {
if (mCblk != NULL) {
+ // 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