Bug 812641: Shut down SipCC instance when number of PeerConnections == 0 (reland) r=ehugg

This commit is contained in:
Randell Jesup 2012-11-17 23:03:58 -05:00
Родитель 436fc9b0fa
Коммит 67fb41348c
1 изменённых файлов: 7 добавлений и 1 удалений

Просмотреть файл

@ -278,8 +278,14 @@ PeerConnectionImpl::PeerConnectionImpl()
PeerConnectionImpl::~PeerConnectionImpl()
{
peerconnections.erase(mHandle);
Close();
// Since this and Initialize() occur on MainThread, they can't both be
// running at once
// Might be more optimal to release off a timer (and XPCOM Shutdown)
// to avoid churn
peerconnections.erase(mHandle);
if (peerconnections.empty())
Shutdown();
/* We should release mPCObserver on the main thread, but also prevent a double free.
nsCOMPtr<nsIThread> mainThread;