jamiaccount: move checkPendingCall in another thread to avoid potential deadlocks

Change-Id: I5e4e54f64152c6fb6c81dfc5b1c8890878d9fdd4
This commit is contained in:
Sébastien Blin
2020-06-08 10:42:30 -04:00
parent a0df228d12
commit 622ae14dd1

View File

@ -492,9 +492,10 @@ JamiAccount::startOutgoingCall(const std::shared_ptr<SIPCall>& call, const std::
auto callId = dev_call->getCallId();
auto onNegoDone = [callId, w=weak()](bool) {
if (auto shared = w.lock()) {
shared->checkPendingCall(callId);
}
runOnMainThread([callId, w]() {
if (auto shared = w.lock())
shared->checkPendingCall(callId);
});
};
std::weak_ptr<SIPCall> weak_dev_call = dev_call;
@ -2104,9 +2105,10 @@ JamiAccount::incomingCall(dht::IceCandidates&& msg, const std::shared_ptr<dht::c
}
auto callId = call->getCallId();
auto onNegoDone = [callId, w=weak()](bool) {
if (auto shared = w.lock()) {
shared->checkPendingCall(callId);
}
runOnMainThread([callId, w]() {
if (auto shared = w.lock())
shared->checkPendingCall(callId);
});
};
auto iceOptions = getIceOptions();
iceOptions.onNegoDone = onNegoDone;