зеркало из https://github.com/mozilla/gecko-dev.git
Bug 821559 - Telephony: ASSERTION: Serious logic problem here. r=bent
This commit is contained in:
Родитель
baf37e6ee8
Коммит
3cc5554be5
|
@ -127,8 +127,13 @@ Telephony::NotifyCallsChanged(TelephonyCall* aCall)
|
|||
nsRefPtr<CallEvent> event = CallEvent::Create(aCall);
|
||||
NS_ASSERTION(event, "This should never fail!");
|
||||
|
||||
if (aCall->CallState() == nsIRadioInterfaceLayer::CALL_STATE_DIALING) {
|
||||
if (aCall->CallState() == nsIRadioInterfaceLayer::CALL_STATE_DIALING ||
|
||||
aCall->CallState() == nsIRadioInterfaceLayer::CALL_STATE_ALERTING ||
|
||||
aCall->CallState() == nsIRadioInterfaceLayer::CALL_STATE_CONNECTED) {
|
||||
NS_ASSERTION(!mActiveCall, "Already have an active call!");
|
||||
mActiveCall = aCall;
|
||||
} else if (mActiveCall && mActiveCall->CallIndex() == aCall->CallIndex()) {
|
||||
mActiveCall = nullptr;
|
||||
}
|
||||
|
||||
nsresult rv =
|
||||
|
@ -383,18 +388,11 @@ Telephony::CallStateChanged(uint32_t aCallIndex, uint16_t aCallState,
|
|||
}
|
||||
|
||||
if (modifiedCall) {
|
||||
|
||||
// See if this should replace our current active call.
|
||||
if (aIsActive) {
|
||||
if (aCallState == nsIRadioInterfaceLayer::CALL_STATE_DISCONNECTED) {
|
||||
mActiveCall = nullptr;
|
||||
} else {
|
||||
mActiveCall = modifiedCall;
|
||||
}
|
||||
} else {
|
||||
if (mActiveCall && mActiveCall->CallIndex() == aCallIndex) {
|
||||
mActiveCall = nullptr;
|
||||
}
|
||||
} else if (mActiveCall && mActiveCall->CallIndex() == aCallIndex) {
|
||||
mActiveCall = nullptr;
|
||||
}
|
||||
|
||||
// Change state.
|
||||
|
@ -403,11 +401,13 @@ Telephony::CallStateChanged(uint32_t aCallIndex, uint16_t aCallState,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// Didn't know anything about this call before now, could be 'incoming' or
|
||||
// 'dialing' that was placed by others.
|
||||
NS_ASSERTION(aCallState == nsIRadioInterfaceLayer::CALL_STATE_INCOMING ||
|
||||
aCallState == nsIRadioInterfaceLayer::CALL_STATE_DIALING,
|
||||
"Serious logic problem here!");
|
||||
// Didn't know anything about this call before now.
|
||||
|
||||
if (aCallState == nsIRadioInterfaceLayer::CALL_STATE_DISCONNECTED) {
|
||||
// Do nothing since we didn't know anything about it before now and it's
|
||||
// been ended already.
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsRefPtr<TelephonyCall> call =
|
||||
TelephonyCall::Create(this, aNumber, aCallState, aCallIndex);
|
||||
|
@ -433,24 +433,22 @@ Telephony::EnumerateCallState(uint32_t aCallIndex, uint16_t aCallState,
|
|||
const nsAString& aNumber, bool aIsActive,
|
||||
bool* aContinue)
|
||||
{
|
||||
#ifdef DEBUG
|
||||
// Make sure we don't somehow add duplicates.
|
||||
for (uint32_t index = 0; index < mCalls.Length(); index++) {
|
||||
NS_ASSERTION(mCalls[index]->CallIndex() != aCallIndex,
|
||||
"Something is really wrong here!");
|
||||
nsRefPtr<TelephonyCall>& tempCall = mCalls[index];
|
||||
if (tempCall->CallIndex() == aCallIndex) {
|
||||
// We have the call already. Skip it.
|
||||
*aContinue = true;
|
||||
return NS_OK;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
nsRefPtr<TelephonyCall> call =
|
||||
TelephonyCall::Create(this, aNumber, aCallState, aCallIndex);
|
||||
NS_ASSERTION(call, "This should never fail!");
|
||||
|
||||
NS_ASSERTION(mCalls.Contains(call), "Should have auto-added new call!");
|
||||
|
||||
if (aIsActive) {
|
||||
NS_ASSERTION(!mActiveCall, "Already have an active call!");
|
||||
mActiveCall = call;
|
||||
}
|
||||
|
||||
*aContinue = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче