From 04fdcf49839109f9c6e6ada47408a63fb7a66fc0 Mon Sep 17 00:00:00 2001 From: "dp%netscape.com" Date: Tue, 3 Aug 1999 00:03:38 +0000 Subject: [PATCH] Using nsObjectHashtable::RemoveAndDelete() --- xpcom/components/nsComponentManager.cpp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/xpcom/components/nsComponentManager.cpp b/xpcom/components/nsComponentManager.cpp index 5bbf3d33ff62..0c2031f5cff7 100644 --- a/xpcom/components/nsComponentManager.cpp +++ b/xpcom/components/nsComponentManager.cpp @@ -1413,8 +1413,8 @@ nsComponentManagerImpl::RegisterFactory(const nsCID &aClass, if (entry) { PR_LOG(nsComponentManagerLog, PR_LOG_WARNING, ("\t\tdeleting old Factory Entry.")); - mFactories->Remove(&key); - delete entry; + mFactories->RemoveAndDelete(&key); + entry = NULL; } mFactories->Put(&key, newEntry); @@ -1529,8 +1529,7 @@ nsComponentManagerImpl::RegisterComponentSpec(const nsCID &aClass, } if (entry) { - mFactories->Remove(&key); - delete entry; + mFactories->RemoveAndDelete(&key); entry = NULL; PR_LOG(nsComponentManagerLog, PR_LOG_WARNING, ("\t\tdeleting registered Factory.")); } @@ -1613,8 +1612,7 @@ nsComponentManagerImpl::RegisterComponentLib(const nsCID &aClass, } if (entry) { - mFactories->Remove(&key); - delete entry; + mFactories->RemoveAndDelete(&key); entry = NULL; PR_LOG(nsComponentManagerLog, PR_LOG_WARNING, ("\t\tdeleting registered Factory.")); } @@ -1656,9 +1654,9 @@ nsComponentManagerImpl::UnregisterFactory(const nsCID &aClass, if (old->factory == aFactory) { PR_EnterMonitor(mMon); - old = (nsFactoryEntry *) mFactories->Remove(&key); + old = (nsFactoryEntry *) mFactories->RemoveAndDelete(&key); + old = NULL; PR_ExitMonitor(mMon); - delete old; res = NS_OK; } @@ -1700,8 +1698,8 @@ nsComponentManagerImpl::UnregisterComponent(const nsCID &aClass, #endif ) { - nsFactoryEntry *entry = (nsFactoryEntry *) mFactories->Remove(&key); - delete entry; + mFactories->RemoveAndDelete(&key); + old = NULL; res = NS_OK; } #ifdef USE_REGISTRY