fix memory leaks (eep) and add some debugging noise for myself
This commit is contained in:
@@ -106,8 +106,8 @@ nsFactoryEntry::nsFactoryEntry(const nsCID &aClass,
|
|||||||
: cid(aClass), factory(nsnull), loader(aLoader)
|
: cid(aClass), factory(nsnull), loader(aLoader)
|
||||||
{
|
{
|
||||||
loader = aLoader;
|
loader = aLoader;
|
||||||
type = nsCRT::strdup(aType);
|
type = aType;
|
||||||
location = nsCRT::strdup(aLocation);
|
location = aLocation;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsFactoryEntry::nsFactoryEntry(const nsCID &aClass, nsIFactory *aFactory)
|
nsFactoryEntry::nsFactoryEntry(const nsCID &aClass, nsIFactory *aFactory)
|
||||||
@@ -674,6 +674,9 @@ nsComponentManagerImpl::PlatformFind(const nsCID &aCID, nsFactoryEntry* *result)
|
|||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
|
#ifdef DEBUG_shaver
|
||||||
|
fprintf(stderr, "NEW FACTORYENTRY(%s,%s)\n", library, componentType);
|
||||||
|
#endif
|
||||||
nsFactoryEntry *res = new nsFactoryEntry(aCID, library, componentType,
|
nsFactoryEntry *res = new nsFactoryEntry(aCID, library, componentType,
|
||||||
loader);
|
loader);
|
||||||
if (res == NULL)
|
if (res == NULL)
|
||||||
@@ -783,6 +786,9 @@ nsresult nsComponentManagerImpl::PlatformPrePopulateRegistry()
|
|||||||
&componentType)))
|
&componentType)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
#ifdef DEBUG_shaver
|
||||||
|
fprintf(stderr, "NEW FACTORYENTRY(%s,%s)\n", library, componentType);
|
||||||
|
#endif
|
||||||
nsFactoryEntry* entry =
|
nsFactoryEntry* entry =
|
||||||
/* hand off componentType and library to factory */
|
/* hand off componentType and library to factory */
|
||||||
new nsFactoryEntry(aClass, library, componentType,
|
new nsFactoryEntry(aClass, library, componentType,
|
||||||
@@ -1389,6 +1395,9 @@ nsComponentManagerImpl::RegisterFactory(const nsCID &aClass,
|
|||||||
return NS_ERROR_FACTORY_EXISTS;
|
return NS_ERROR_FACTORY_EXISTS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG_shaver
|
||||||
|
fprintf(stderr, "NEW FACTORYENTRY(Factory,%s)\n", aProgID);
|
||||||
|
#endif
|
||||||
nsFactoryEntry *newEntry = new nsFactoryEntry(aClass, aFactory);
|
nsFactoryEntry *newEntry = new nsFactoryEntry(aClass, aFactory);
|
||||||
if (newEntry == NULL)
|
if (newEntry == NULL)
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
@@ -1556,6 +1565,9 @@ nsComponentManagerImpl::RegisterComponentCommon(const nsCID &aClass,
|
|||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG_shaver
|
||||||
|
fprintf(stderr, "NEW FACTORYENTRY(%s,%s)\n", aRegistryName, aType);
|
||||||
|
#endif
|
||||||
/* hand off aRegistryName to entry */
|
/* hand off aRegistryName to entry */
|
||||||
newEntry = new nsFactoryEntry(aClass, aRegistryName,
|
newEntry = new nsFactoryEntry(aClass, aRegistryName,
|
||||||
nsCRT::strdup(aType),
|
nsCRT::strdup(aType),
|
||||||
|
|||||||
@@ -185,21 +185,25 @@ public:
|
|||||||
|
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
if (!loader.get()) {
|
if (!loader.get()) {
|
||||||
|
#ifdef DEBUG_shaver
|
||||||
|
fprintf(stderr, "NFE: getting loader for %s\n", type);
|
||||||
|
#endif
|
||||||
rv = mgr->GetLoaderForType(type, getter_AddRefs(loader));
|
rv = mgr->GetLoaderForType(type, getter_AddRefs(loader));
|
||||||
if(NS_FAILED(rv))
|
if(NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG_shaver
|
||||||
|
char *cidStr = cid.ToString();
|
||||||
|
fprintf(stderr, "NFE: getting factory for %s \n", cidStr);
|
||||||
|
delete [] cidStr;
|
||||||
|
#endif
|
||||||
rv = loader->GetFactory(cid, location, type, aFactory);
|
rv = loader->GetFactory(cid, location, type, aFactory);
|
||||||
if (NS_SUCCEEDED(rv))
|
if (NS_SUCCEEDED(rv))
|
||||||
factory = do_QueryInterface(*aFactory);
|
factory = do_QueryInterface(*aFactory);
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0 /* unused? */
|
|
||||||
nsresult Init(nsHashtable* dllHashtable, const nsCID &aClass, const char *aLibrary,
|
|
||||||
PRTime lastModTime, PRUint32 fileSize);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
nsCID cid;
|
nsCID cid;
|
||||||
char *location;
|
char *location;
|
||||||
nsCOMPtr<nsIFactory> factory;
|
nsCOMPtr<nsIFactory> factory;
|
||||||
|
|||||||
@@ -65,6 +65,9 @@ private:
|
|||||||
nsNativeComponentLoader::nsNativeComponentLoader() :
|
nsNativeComponentLoader::nsNativeComponentLoader() :
|
||||||
mRegistry(nsnull), mCompMgr(nsnull), mDllStore(nsnull)
|
mRegistry(nsnull), mCompMgr(nsnull), mDllStore(nsnull)
|
||||||
{
|
{
|
||||||
|
#ifdef DEBUG_shaver
|
||||||
|
fprintf(stderr, "NEW NATIVECOMPONENTLOADER\n");
|
||||||
|
#endif
|
||||||
NS_INIT_REFCNT();
|
NS_INIT_REFCNT();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user