Don't double destruct audio_track_cblk_t

Fortunately audio_track_cblk_t doesn't have a destructor, but for clarity
remove the double destruction.

Also add warning not to add any virtuals to audio_track_cblk_t.

Change-Id: I70ebe1a70460c7002145b2cdf10f9f137396e6f3
This commit is contained in:
Glenn Kasten
2012-02-03 10:24:48 -08:00
parent f55bc56490
commit d9d68dcb62
2 changed files with 5 additions and 2 deletions

View File

@@ -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
{

View File

@@ -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