Wince being unicode has the interesting habit of initting xpcom twice.

Handle this a bit better.


git-svn-id: svn://10.0.0.236/branches/WINCE_20020710_BRANCH@133873 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
blythe%netscape.com
2002-11-15 01:26:03 +00:00
parent 8b537e864e
commit ee0eff71fe
2 changed files with 50 additions and 0 deletions

View File

@@ -417,6 +417,46 @@ nsresult NS_COM NS_InitXPCOM2(nsIServiceManager* *result,
NS_ADDREF(*result = serviceManager);
}
}
#if defined(WINCE)
else
{
// WINCE may cause multiple XPCOM initializations, due to some unicode
// string conversions other code requiers....
//
// Handle that here.
compMgr = nsComponentManagerImpl::gComponentManager;
PRBool value;
if (binDirectory)
{
rv = binDirectory->IsDirectory(&value);
if (NS_SUCCEEDED(rv) && value)
{
gDirectoryService->Define(NS_XPCOM_INIT_CURRENT_PROCESS_DIR, binDirectory);
}
nsCAutoString path;
binDirectory->GetNativePath(path);
nsFileSpec spec(path.get());
nsSpecialSystemDirectory::Set(nsSpecialSystemDirectory::Moz_BinDirectory, &spec);
}
if (appFileLocationProvider) {
rv = dirService->RegisterProvider(appFileLocationProvider);
if (NS_FAILED(rv))
{
return rv;
}
}
if (result) {
nsIServiceManager *serviceManager = NS_STATIC_CAST(nsIServiceManager*, compMgr);
NS_ADDREF(*result = serviceManager);
}
}
#endif /* WINCE */
nsCOMPtr<nsIMemory> memory;
NS_GetMemoryManager(getter_AddRefs(memory));

View File

@@ -393,6 +393,7 @@ nsIThread::GetIThread(PRThread* prthread, nsIThread* *result)
return NS_OK;
}
#if !defined(WINCE)
NS_COM nsresult
nsIThread::SetMainThread()
{
@@ -404,6 +405,15 @@ nsIThread::SetMainThread()
}
return GetCurrent(&gMainThread);
}
#else /* WINCE */
NS_COM nsresult
nsIThread::SetMainThread()
{
// wince, being unicode, may unfortunately initialize xpcom2 multiple
// times to perform rudimentary upper case conversion....
return GetCurrent(&gMainThread);
}
#endif /* WINCE */
NS_COM nsresult
nsIThread::GetMainThread(nsIThread **result)