зеркало из https://github.com/mozilla/gecko-dev.git
Bug 772765 - part5 - Telephony DOM - fix unlink crash. r=bent
This commit is contained in:
Родитель
6c4c371456
Коммит
a9fa564c3e
|
@ -91,13 +91,7 @@ Telephony::Telephony()
|
|||
|
||||
Telephony::~Telephony()
|
||||
{
|
||||
if (mListener) {
|
||||
mListener->Disconnect();
|
||||
|
||||
if (mProvider) {
|
||||
mProvider->UnregisterTelephonyMsg(mListener);
|
||||
}
|
||||
}
|
||||
Shutdown();
|
||||
|
||||
NS_ASSERTION(gTelephonyList, "This should never be null!");
|
||||
NS_ASSERTION(gTelephonyList->Contains(this), "Should be in the list!");
|
||||
|
@ -105,12 +99,26 @@ Telephony::~Telephony()
|
|||
if (gTelephonyList->Length() == 1) {
|
||||
delete gTelephonyList;
|
||||
gTelephonyList = nullptr;
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
gTelephonyList->RemoveElement(this);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
Telephony::Shutdown()
|
||||
{
|
||||
if (mListener) {
|
||||
mListener->Disconnect();
|
||||
|
||||
if (mProvider) {
|
||||
mProvider->UnregisterTelephonyMsg(mListener);
|
||||
mProvider = nullptr;
|
||||
}
|
||||
|
||||
mListener = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
JSObject*
|
||||
Telephony::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
|
||||
{
|
||||
|
@ -309,6 +317,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
|||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(Telephony,
|
||||
nsDOMEventTargetHelper)
|
||||
tmp->Shutdown();
|
||||
tmp->mActiveCall = nullptr;
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mCalls)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mCallsList)
|
||||
|
|
|
@ -176,6 +176,9 @@ private:
|
|||
|
||||
bool
|
||||
MoveCall(uint32_t aCallIndex, bool aIsConference);
|
||||
|
||||
void
|
||||
Shutdown();
|
||||
};
|
||||
|
||||
END_TELEPHONY_NAMESPACE
|
||||
|
|
Загрузка…
Ссылка в новой задаче