From 37891802cbe21f8095c08d7e34cc9cec4a06c4c4 Mon Sep 17 00:00:00 2001 From: "timeless%mozdev.org" Date: Mon, 7 Apr 2003 14:20:19 +0000 Subject: [PATCH] Bug 199006 there are two independent initializations of nsMemoryImpl before Init_XPCOM2 finishes r=dougt --- xpcom/base/nsMemoryImpl.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/xpcom/base/nsMemoryImpl.cpp b/xpcom/base/nsMemoryImpl.cpp index 121d2abdb0e9..33b665e632d0 100644 --- a/xpcom/base/nsMemoryImpl.cpp +++ b/xpcom/base/nsMemoryImpl.cpp @@ -212,6 +212,8 @@ MemoryFlusher::Stop() //---------------------------------------------------------------------- +nsMemoryImpl* gMemory = nsnull; + NS_IMPL_THREADSAFE_ISUPPORTS1(nsMemoryImpl, nsIMemory) NS_METHOD @@ -219,6 +221,8 @@ nsMemoryImpl::Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr) { NS_ENSURE_ARG_POINTER(aInstancePtr); NS_ENSURE_PROPER_AGGREGATION(outer, aIID); + if (gMemory && NS_SUCCEEDED(gMemory->QueryInterface(aIID, aInstancePtr))) + return NS_OK; nsMemoryImpl* mm = new nsMemoryImpl(); if (mm == NULL) @@ -484,8 +488,6 @@ nsMemoryImpl::DestroyFlushEvent(PLEvent* aEvent) // no-op, since mEvent is a member of nsMemoryImpl } -nsMemoryImpl* gMemory = nsnull; - static void EnsureGlobalMemoryService() {