Bug 1003658 - Avoid to create reference cycle in BluetoothProfileController which would cause memory leak. r=echou, f=shuang

This commit is contained in:
Jamin Liu 2014-05-07 10:57:27 +08:00
parent 43e932c8d7
commit 8da6a0a900
2 changed files with 2 additions and 4 deletions

View File

@ -69,7 +69,6 @@ BluetoothProfileController::BluetoothProfileController(
mTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
MOZ_ASSERT(mTimer);
mCheckProfileStatusCallback = new CheckProfileStatusCallback(this);
mProfiles.Clear();
/**
@ -225,8 +224,8 @@ BluetoothProfileController::StartSession()
}
if (mTimer) {
mTimer->InitWithCallback(mCheckProfileStatusCallback, CONNECTION_TIMEOUT_MS,
nsITimer::TYPE_ONE_SHOT);
mTimer->InitWithCallback(new CheckProfileStatusCallback(this),
CONNECTION_TIMEOUT_MS, nsITimer::TYPE_ONE_SHOT);
}
BT_LOGR("%s", mConnect ? "connecting" : "disconnecting");

View File

@ -139,7 +139,6 @@ private:
} mTarget;
nsCOMPtr<nsITimer> mTimer;
nsCOMPtr<nsITimerCallback> mCheckProfileStatusCallback;
};
END_BLUETOOTH_NAMESPACE