Changeset 101846 in vbox for trunk/src/libs/xpcom18a4
- Timestamp:
- Nov 6, 2023 9:34:26 AM (17 months ago)
- svn:sync-xref-src-repo-rev:
- 159942
- Location:
- trunk/src/libs/xpcom18a4
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/libs/xpcom18a4/python/src/dllmain.cpp
r59809 r101846 47 47 48 48 #include "PyXPCOM_std.h" 49 #include <prthread.h>50 #include "nsIThread.h"51 49 #include "nsILocalFile.h" 52 50 … … 294 292 static PRBool bHaveInitXPCOM = PR_FALSE; 295 293 if (!bHaveInitXPCOM) { 296 nsCOMPtr<nsIThread> thread_check; 297 // xpcom appears to assert if already initialized 298 // Is there an official way to determine this? 299 if (NS_FAILED(nsIThread::GetMainThread(getter_AddRefs(thread_check)))) { 294 295 if (!NS_IsXPCOMInitialized()) { 300 296 // not already initialized. 301 #ifdef XP_WIN302 // On Windows, we need to locate the Mozilla bin303 // directory. This by using locating a Moz DLL we depend304 // on, and assume it lives in that bin dir. Different305 // moz build types (eg, xulrunner, suite) package306 // XPCOM itself differently - but all appear to require307 // nspr4.dll - so this is what we use.308 char landmark[MAX_PATH+1];309 HMODULE hmod = GetModuleHandle("nspr4.dll");310 if (hmod==NULL) {311 PyErr_SetString(PyExc_RuntimeError, "We dont appear to be linked against nspr4.dll.");312 return PR_FALSE;313 }314 GetModuleFileName(hmod, landmark, sizeof(landmark)/sizeof(landmark[0]));315 char *end = landmark + (strlen(landmark)-1);316 while (end > landmark && *end != '\\')317 end--;318 if (end > landmark) *end = '\0';319 320 nsCOMPtr<nsILocalFile> ns_bin_dir;321 NS_ConvertASCIItoUCS2 strLandmark(landmark);322 NS_NewLocalFile(strLandmark, PR_FALSE, getter_AddRefs(ns_bin_dir));323 nsresult rv = NS_InitXPCOM2(nsnull, ns_bin_dir, nsnull);324 #else325 297 // Elsewhere, Mozilla can find it itself (we hope!) 326 298 nsresult rv = NS_InitXPCOM2(nsnull, nsnull, nsnull); 327 #endif // XP_WIN328 299 if (NS_FAILED(rv)) { 329 300 PyErr_SetString(PyExc_RuntimeError, "The XPCOM subsystem could not be initialized"); -
trunk/src/libs/xpcom18a4/xpcom/build/nsXPCOM.h
r11551 r101846 68 68 class nsITraceRefcnt; 69 69 70 #ifdef VBOX 71 /** 72 * Checks whether XPCOM was initialized by a call to NS_InitXPCOM2(). 73 */ 74 extern "C" NS_COM PRBool 75 NS_IsXPCOMInitialized(void); 76 #endif 77 70 78 /** 71 79 * Initialises XPCOM. You must call this method before proceeding -
trunk/src/libs/xpcom18a4/xpcom/build/nsXPComInit.cpp
r101837 r101846 310 310 nsIProperties *gDirectoryService = NULL; 311 311 PRBool gXPCOMShuttingDown = PR_FALSE; 312 #ifdef VBOX 313 static PRBool gXPCOMInitialized = PR_FALSE; 314 #endif 312 315 313 316 // For each class that wishes to support nsIClassInfo, add a line like this … … 469 472 } 470 473 474 #ifdef VBOX 475 PRBool NS_COM NS_IsXPCOMInitialized(void) 476 { 477 return gXPCOMInitialized; 478 } 479 #endif 480 471 481 nsresult NS_COM NS_InitXPCOM(nsIServiceManager* *result, 472 482 nsIFile* binDirectory) … … 732 742 NS_XPCOM_STARTUP_OBSERVER_ID); 733 743 744 #ifdef VBOX 745 gXPCOMInitialized = PR_TRUE; 746 #endif 734 747 return NS_OK; 735 748 } … … 915 928 #endif 916 929 930 #ifdef VBOX 931 gXPCOMInitialized = PR_FALSE; 932 #endif 917 933 return NS_OK; 918 934 }
Note:
See TracChangeset
for help on using the changeset viewer.