From d5a44a6b73dd2eb856c23569687a6d3d65eab428 Mon Sep 17 00:00:00 2001 From: "timeless%mozdev.org" Date: Fri, 18 Feb 2005 22:46:24 +0000 Subject: [PATCH] Bug 282743 ABBA deadlock componentmanager monitor/jsgc claimscope r=dougt sr=bz --- xpcom/components/nsComponentManager.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/xpcom/components/nsComponentManager.cpp b/xpcom/components/nsComponentManager.cpp index ecfd7594172a..8d13761041e6 100644 --- a/xpcom/components/nsComponentManager.cpp +++ b/xpcom/components/nsComponentManager.cpp @@ -2365,7 +2365,13 @@ nsComponentManagerImpl::GetServiceByContractID(const char* aContractID, if (entry) { if (entry->mServiceObject) { - return entry->mServiceObject->QueryInterface(aIID, result); + nsCOMPtr serviceObject = entry->mServiceObject; + // We need to not be holding the service manager's monitor while calling + // QueryInterface, because it invokes user code which could try to re-enter + // the service manager, or try to grab some other lock/monitor/condvar + // and deadlock, e.g. bug 282743. + mon.Exit(); + return serviceObject->QueryInterface(aIID, result); } #ifdef XPCOM_CHECK_PENDING_CIDS rv = AddPendingCID(entry->mCid);