mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-22 03:43:58 +00:00
Bug #15292, r=dp. Made the component manager inherit from |nsSupportsWeakReference|, fixed its |QueryInterface()| appropriately, and added casts in two places that became ambiguous now that the component manager had multiple |nsISupports| in it. Now one can hold a weak reference to the component manager using |nsIWeakReference|.
This commit is contained in:
parent
3701af60c8
commit
ef8d06d258
@ -206,7 +206,7 @@ nsresult NS_COM NS_InitXPCOM(nsIServiceManager* *result,
|
||||
nsComponentManagerImpl::gComponentManager = compMgr;
|
||||
}
|
||||
|
||||
rv = servMgr->RegisterService(kComponentManagerCID, compMgr);
|
||||
rv = servMgr->RegisterService(kComponentManagerCID, NS_STATIC_CAST(nsIComponentManager*, compMgr));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// 3. Register the global services with the component manager so that
|
||||
|
@ -290,7 +290,7 @@ nsComponentManagerImpl::~nsComponentManagerImpl()
|
||||
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsComponentManagerImpl, NS_GET_IID(nsIComponentManager));
|
||||
NS_IMPL_ISUPPORTS2(nsComponentManagerImpl, nsIComponentManager, nsISupportsWeakReference)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsComponentManagerImpl: Platform methods
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "prtime.h"
|
||||
#include "prmon.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsWeakReference.h"
|
||||
|
||||
class nsFactoryEntry;
|
||||
class nsDll;
|
||||
@ -44,7 +45,7 @@ extern const char XPCOM_LIB_PREFIX[];
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
class nsComponentManagerImpl : public nsIComponentManager {
|
||||
class nsComponentManagerImpl : public nsIComponentManager, public nsSupportsWeakReference {
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSICOMPONENTMANAGER
|
||||
|
@ -365,7 +365,7 @@ nsFreeLibrary(nsDll *dll, nsIServiceManager *serviceMgr, PRInt32 when)
|
||||
// Get the module object
|
||||
nsCOMPtr<nsIModule> mobj;
|
||||
/* XXXshaver cheat and use the global component manager */
|
||||
rv = dll->GetModule(nsComponentManagerImpl::gComponentManager,
|
||||
rv = dll->GetModule(NS_STATIC_CAST(nsIComponentManager*, nsComponentManagerImpl::gComponentManager),
|
||||
getter_AddRefs(mobj));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user