Bug 367792 - Crash when running tests that call initXPCOM.

This commit is contained in:
pedemont%us.ibm.com 2007-03-02 16:56:30 +00:00
Родитель b96d2de499
Коммит 7f43d5a7f5
1 изменённых файлов: 7 добавлений и 10 удалений

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

@ -14,7 +14,7 @@
* The Original Code is Java XPCOM Bindings.
*
* The Initial Developer of the Original Code is IBM Corporation.
* Portions created by the Initial Developer are Copyright (C) 2006
* Portions created by the Initial Developer are Copyright (C) 2007
* IBM Corporation. All Rights Reserved.
*
* Contributor(s):
@ -132,19 +132,16 @@ InitXPCOM_Impl(JNIEnv* env, jobject aMozBinDirectory,
}
// create nsAppFileLocProviderProxy from given Java object
nsAppFileLocProviderProxy* provider = nsnull;
nsCOMPtr<nsIDirectoryServiceProvider> provider;
if (aAppFileLocProvider) {
provider = new nsAppFileLocProviderProxy(aAppFileLocProvider);
if (!provider)
return NS_ERROR_OUT_OF_MEMORY;
rv = NS_NewAppFileLocProviderProxy(aAppFileLocProvider,
getter_AddRefs(provider));
NS_ENSURE_SUCCESS(rv, rv);
}
// init XPCOM
nsCOMPtr<nsIServiceManager> servMan;
rv = NS_InitXPCOM2(getter_AddRefs(servMan), directory, provider);
if (provider) {
delete provider;
}
NS_ENSURE_SUCCESS(rv, rv);
// create Java proxy for service manager returned by NS_InitXPCOM2
@ -171,11 +168,11 @@ extern "C" NS_EXPORT void JNICALL
XPCOM_NATIVE(shutdownXPCOM) (JNIEnv *env, jobject, jobject aServMgr)
{
nsresult rv;
nsCOMPtr<nsIServiceManager> servMgr;
nsIServiceManager* servMgr = nsnull;
if (aServMgr) {
// Get native XPCOM instance
rv = GetNewOrUsedXPCOMObject(env, aServMgr, NS_GET_IID(nsIServiceManager),
getter_AddRefs(servMgr));
(nsISupports**) &servMgr);
NS_ASSERTION(NS_SUCCEEDED(rv), "Failed to get XPCOM obj for ServiceMgr.");
// Even if we failed to get the matching xpcom object, we don't abort this