VirtualBox

Ignore:
Timestamp:
Jan 25, 2017 10:06:46 AM (8 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
113053
Message:

XPCOM: Previous change broke the shutdown detection in nsExceptionService, causing races with creating new exception manager instances when XPCOM shutdown has begun. The race happened when XPCOM shutdown was destroying all object instances for the known components. With "enough luck" nsExceptionService::GetCurrentExceptionManager created a new manager which by the time the AddRef call at the end was reached would've been already freed (which happens regardless of refcounts for obvious reasons).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/libs/xpcom18a4/xpcom/base/nsExceptionService.cpp

    r62170 r65440  
    4545static const PRUintn BAD_TLS_INDEX = (PRUintn) -1;
    4646
    47 #define CHECK_SERVICE_USE_OK() if (!lock) return NS_ERROR_NOT_INITIALIZED
    48 #define CHECK_MANAGER_USE_OK() if (!mService || !nsExceptionService::lock) return NS_ERROR_NOT_INITIALIZED
     47#define CHECK_SERVICE_USE_OK() if (tlsIndex == BAD_TLS_INDEX) return NS_ERROR_NOT_INITIALIZED
     48#define CHECK_MANAGER_USE_OK() if (!mService || nsExceptionService::tlsIndex == BAD_TLS_INDEX) return NS_ERROR_NOT_INITIALIZED
    4949
    5050// A key for our registered module providers hashtable
     
    225225void nsExceptionService::Shutdown()
    226226{
    227   PR_SetThreadPrivate(tlsIndex, nsnull);
     227  PRUintn tmp = tlsIndex;
     228  tlsIndex = BAD_TLS_INDEX;
     229  PR_SetThreadPrivate(tmp, nsnull);
    228230  mProviders.Reset();
    229231  if (lock) {
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette