Changeset 55458 in vbox for trunk/src/VBox/Main/src-server/xpcom
- Timestamp:
- Apr 27, 2015 4:38:40 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 99805
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/src-server/xpcom/server.cpp
r51498 r55458 132 132 static uint32_t gShutdownDelayMs = 5000; 133 133 134 static ns IEventQueue *gEventQ= nsnull;134 static nsCOMPtr<nsIEventQueue> gEventQ = nsnull; 135 135 static PRBool volatile gKeepRunning = PR_TRUE; 136 136 static PRBool volatile gAllowSigUsrQuit = PR_TRUE; … … 232 232 233 233 PRBool onMainThread = PR_TRUE; 234 if (gEventQ) 235 gEventQ->IsOnCurrentThread(&onMainThread); 234 nsCOMPtr<nsIEventQueue> q(gEventQ); 235 if (q) 236 { 237 q->IsOnCurrentThread(&onMainThread); 238 q = nsnull; 239 } 236 240 237 241 PRBool timerStarted = PR_FALSE; … … 289 293 */ 290 294 291 Assert( gEventQ == NULL);295 Assert(!gEventQ); 292 296 } 293 297 } … … 356 360 * and this method was so lucky that it got a chance to run before 357 361 * the timer was killed. */ 358 AssertReturnVoid(gEventQ); 362 nsCOMPtr<nsIEventQueue> q(gEventQ); 363 AssertReturnVoid(q); 359 364 360 365 /* post a quit event to the main queue */ 361 366 MaybeQuitEvent *ev = new MaybeQuitEvent(); 362 nsresult rv = ev->postTo( gEventQ);367 nsresult rv = ev->postTo(q); 363 368 NOREF(rv); 364 369 … … 392 397 RTTimerLRDestroy(sTimer); 393 398 sTimer = NULL; 394 395 RTCritSectDelete(&sLock);396 399 397 400 if (sInstance != NULL) … … 404 407 sInstance->Release(); 405 408 } 409 410 /* Destroy lock after releasing the VirtualBox instance, otherwise 411 * there are races with cleanup. */ 412 RTCritSectDelete(&sLock); 406 413 407 414 return NS_OK; … … 594 601 static void signal_handler(int sig) 595 602 { 596 if (gEventQ && gKeepRunning) 603 nsCOMPtr<nsIEventQueue> q(gEventQ); 604 if (q && gKeepRunning) 597 605 { 598 606 if (sig == SIGUSR1) … … 601 609 { 602 610 VirtualBoxClassFactory::MaybeQuitEvent *ev = new VirtualBoxClassFactory::MaybeQuitEvent(); 603 ev->postTo( gEventQ);611 ev->postTo(q); 604 612 } 605 613 /* else do nothing */ … … 609 617 /* post a force quit event to the queue */ 610 618 ForceQuitEvent *ev = new ForceQuitEvent(); 611 ev->postTo( gEventQ);619 ev->postTo(q); 612 620 } 613 621 } … … 863 871 * gets created upon XPCOM startup, so it will use the main (this) 864 872 * thread's event queue to receive IPC events) */ 865 rc = NS_GetMainEventQ( &gEventQ);873 rc = NS_GetMainEventQ(getter_AddRefs(gEventQ)); 866 874 if (NS_FAILED(rc)) 867 875 { … … 992 1000 993 1001 NS_IF_RELEASE(gIpcServ); 994 NS_IF_RELEASE(gEventQ);1002 gEventQ = nsnull; 995 1003 996 1004 /* no nsCOMPtrs are allowed to be alive when you call com::Shutdown(). */
Note:
See TracChangeset
for help on using the changeset viewer.