fix to make unregistering a category work. r=rginda, sr=dveditz, b=177176 m a=robert@ocallahan.org

This commit is contained in:
dougt%netscape.com 2002-10-30 00:57:40 +00:00
Родитель 00f6a8cdac
Коммит 5585934f9b
1 изменённых файлов: 14 добавлений и 3 удалений

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

@ -42,7 +42,6 @@
#include "nsCOMPtr.h"
#include "nsHashtable.h"
#include "nsIFactory.h"
#include "nsIRegistry.h"
#include "nsSupportsPrimitives.h"
#include "nsIObserver.h"
#include "nsComponentManager.h"
@ -62,6 +61,9 @@
Leaf nodes are strings.
*/
// this function is not public yet, hence it is externed here.
extern nsresult NS_GetComponentLoaderManager(nsIComponentLoaderManager* *result);
static
NS_IMETHODIMP
@ -270,8 +272,6 @@ nsCategoryManager::AddCategoryEntry( const char *aCategoryName,
nsCStringKey entryNameKey(aEntryName);
category->Put(&entryNameKey, entry);
// this function is not public yet, hence it is externed here.
extern nsresult NS_GetComponentLoaderManager(nsIComponentLoaderManager* *result);
nsCOMPtr<nsIComponentLoaderManager> mgr;
NS_GetComponentLoaderManager(getter_AddRefs(mgr));
if (mgr)
@ -303,6 +303,12 @@ nsCategoryManager::DeleteCategoryEntry( const char *aCategoryName,
{
nsCStringKey entryKey(aEntryName);
category->RemoveAndDelete(&entryKey);
nsCOMPtr<nsIComponentLoaderManager> mgr;
NS_GetComponentLoaderManager(getter_AddRefs(mgr));
if (mgr)
mgr->FlushPersistentStore(PR_FALSE);
}
return NS_OK;
@ -315,6 +321,11 @@ nsCategoryManager::DeleteCategory( const char *aCategoryName )
{
NS_ASSERTION(aCategoryName, "aCategoryName is NULL!");
nsCOMPtr<nsIComponentLoaderManager> mgr;
NS_GetComponentLoaderManager(getter_AddRefs(mgr));
if (mgr)
mgr->FlushPersistentStore(PR_FALSE);
// QUESTION: consider whether this should be an error
nsCStringKey categoryKey(aCategoryName);
return RemoveAndDelete(&categoryKey) ? NS_OK : NS_ERROR_NOT_AVAILABLE;