Bug 832109 - 'crash in Telephony::RILTelephonyCallback::CallStateChanged'. r=jlebar.

This commit is contained in:
Ben Turner 2013-02-18 08:09:40 -08:00
parent faf4189886
commit 4ab08498e6
2 changed files with 29 additions and 18 deletions

View File

@ -45,8 +45,12 @@ Telephony::Telephony()
Telephony::~Telephony()
{
if (mRIL && mRILTelephonyCallback) {
mRIL->UnregisterTelephonyCallback(mRILTelephonyCallback);
if (mRILTelephonyCallback) {
mRILTelephonyCallback->Disable();
if (mRIL) {
mRIL->UnregisterTelephonyCallback(mRILTelephonyCallback);
}
}
if (mRooted) {

View File

@ -21,8 +21,30 @@ BEGIN_TELEPHONY_NAMESPACE
class Telephony : public nsDOMEventTargetHelper,
public nsIDOMTelephony
{
class RILTelephonyCallback : public nsIRILTelephonyCallback
{
Telephony* mTelephony;
public:
NS_DECL_ISUPPORTS
NS_FORWARD_SAFE_NSIRILTELEPHONYCALLBACK(mTelephony)
RILTelephonyCallback(Telephony* aTelephony)
: mTelephony(aTelephony)
{
NS_ASSERTION(mTelephony, "Null pointer!");
}
void
Disable()
{
NS_ASSERTION(mTelephony, "Disable called more than once!");
mTelephony = nullptr;
}
};
nsCOMPtr<nsIRILContentHelper> mRIL;
nsCOMPtr<nsIRILTelephonyCallback> mRILTelephonyCallback;
nsRefPtr<RILTelephonyCallback> mRILTelephonyCallback;
TelephonyCall* mActiveCall;
nsTArray<nsRefPtr<TelephonyCall> > mCalls;
@ -103,21 +125,6 @@ private:
nsresult
DispatchCallEvent(const nsAString& aType,
nsIDOMTelephonyCall* aCall);
class RILTelephonyCallback : public nsIRILTelephonyCallback
{
Telephony* mTelephony;
public:
NS_DECL_ISUPPORTS
NS_FORWARD_NSIRILTELEPHONYCALLBACK(mTelephony->)
RILTelephonyCallback(Telephony* aTelephony)
: mTelephony(aTelephony)
{
NS_ASSERTION(mTelephony, "Null pointer!");
}
};
};
END_TELEPHONY_NAMESPACE