Changeset 36814 in vbox
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/glue/glue-java.xsl
r36270 r36814 2446 2446 private IVirtualBox vbox; 2447 2447 private nsIComponentManager componentManager; 2448 private nsIServiceManager servMgr; 2449 2450 private VirtualBoxManager(Mozilla mozilla, nsIServiceManager servMgr) 2448 2449 private VirtualBoxManager(Mozilla mozilla) 2451 2450 { 2452 2451 this.mozilla = mozilla; 2453 this.servMgr = servMgr;2454 2452 this.componentManager = mozilla.getComponentManager(); 2455 2453 this.vbox = new IVirtualBox((org.mozilla.interfaces.IVirtualBox) this.componentManager … … 2503 2501 2504 2502 private static boolean hasInstance = false; 2503 private static boolean isMozillaInited = false; 2505 2504 2506 2505 public static synchronized VirtualBoxManager createInstance(String home) … … 2508 2507 if (hasInstance) 2509 2508 throw new VBoxException(null, "only one instance at the time allowed"); 2509 if (home == null || "".equals(home)) 2510 home = System.getProperty("vbox.home"); 2510 2511 2511 2512 if (home == null) 2512 home = System.getProperty("vbox.home");2513 throw new RuntimeException("vbox.home Java property must be defined to use XPCOM bridge"); 2513 2514 2514 2515 File grePath = new File(home); 2516 2515 2517 Mozilla mozilla = Mozilla.getInstance(); 2516 mozilla.initialize(grePath); 2517 nsIServiceManager servMgr = null; 2518 try { 2519 servMgr = mozilla.initXPCOM(grePath, null); 2520 } catch (Exception e) { 2521 e.printStackTrace(); 2522 return null; 2518 if (!isMozillaInited) 2519 { 2520 mozilla.initialize(grePath); 2521 try { 2522 mozilla.initXPCOM(grePath, null); 2523 isMozillaInited = true; 2524 } catch (Exception e) { 2525 e.printStackTrace(); 2526 return null; 2527 } 2523 2528 } 2524 2529 2525 2530 hasInstance = true; 2526 2531 2527 return new VirtualBoxManager(mozilla , servMgr);2532 return new VirtualBoxManager(mozilla); 2528 2533 } 2529 2534 … … 2535 2540 { 2536 2541 deinitPerThread(); 2537 // cleanup 2538 mozilla.shutdownXPCOM(servMgr); 2542 // cleanup, we don't do that, as XPCOM bridge doesn't cleanly 2543 // shuts down, so we prefer to avoid native shutdown 2544 // mozilla.shutdownXPCOM(null); 2539 2545 mozilla = null; 2540 2546 hasInstance = false; -
trunk/src/libs/xpcom18a4/java/src/org/mozilla/xpcom/internal/XPCOMJavaProxy.java
r29140 r36814 256 256 257 257 } 258
Note:
See TracChangeset
for help on using the changeset viewer.