VirtualBox

Ticket #15568: exceptionservice.diff

File exceptionservice.diff, 2.9 KB (added by Klaus Espenlaub, 8 years ago)
  • src/libs/xpcom18a4/xpcom/base/nsExceptionService.cpp

     
    8383
    8484#ifdef NS_DEBUG
    8585  inline nsrefcnt ReleaseQuiet() {
    86     // shut up NS_ASSERT_OWNINGTHREAD (see explaination below)
     86    // shut up NS_ASSERT_OWNINGTHREAD (see explanation below)
    8787    nsAutoOwningThread old = _mOwningThread;
    8888    _mOwningThread = nsAutoOwningThread();
    8989    nsrefcnt ref = Release();
     
    114114// instance on creation). In both cases, there should be no other threads
    115115// holding objects (i.e. it's thread-safe to call them), but
    116116// NS_CheckThreadSafe() assertions will still happen and yell in the debug
    117 // build. Since it is quite annoying, we use a special ReleaseQuiet() mehtod
     117// build. Since it is quite annoying, we use a special ReleaseQuiet() method
    118118// in DoDropThread() to shut them up.
    119119NS_IMPL_THREADSAFE_ISUPPORTS1(nsExceptionManager, nsIExceptionManager)
    120120
     
    164164/* The Exception Service */
    165165
    166166PRUintn nsExceptionService::tlsIndex = BAD_TLS_INDEX;
    167 PRLock *nsExceptionService::lock = PR_FALSE;
     167PRLock *nsExceptionService::lock = nsnull;
    168168nsExceptionManager *nsExceptionService::firstThread = nsnull;
    169169
    170170#ifdef NS_DEBUG
     
    200200nsExceptionService::~nsExceptionService()
    201201{
    202202  Shutdown();
     203  if (lock) {
     204    PRLock *tmp = lock;
     205    lock = nsnull;
     206    PR_DestroyLock(tmp);
     207  }
    203208  /* destructor code */
    204209#ifdef NS_DEBUG
    205210  PR_AtomicDecrement(&totalInstances);
     
    210215void nsExceptionService::ThreadDestruct( void *data )
    211216{
    212217  if (!lock) {
    213     // a typical situation is when IPC worker threads that have instantiated
    214     // exception managers are stopped after nsExceptionService is shut down,
    215     // which will result into this warning.  disable it.
    216 #if 0   
    217218    NS_WARNING("nsExceptionService ignoring thread destruction after shutdown");
    218 #endif   
    219219    return;
    220220  }
    221221  DropThread( (nsExceptionManager *)data );
     
    224224
    225225void nsExceptionService::Shutdown()
    226226{
     227  PR_SetThreadPrivate(tlsIndex, nsnull);
    227228  mProviders.Reset();
    228229  if (lock) {
    229230    DropAllThreads();
    230     PR_DestroyLock(lock);
    231     lock = nsnull;
    232231  }
    233   PR_SetThreadPrivate(tlsIndex, nsnull);
    234232}
    235233
    236234/* void setCurrentException (in nsIException error); */
     
    355353{
    356354    nsExceptionManager **emp = &firstThread;
    357355    while (*emp != thread) {
    358         NS_ABORT_IF_FALSE(*emp, "Could not find the thread to drop!");
     356        if (!*emp)
     357        {
     358            NS_WARNING("Could not find the thread to drop!");
     359            return;
     360        }
    359361        emp = &(*emp)->mNextThread;
    360362    }
    361363    *emp = thread->mNextThread;
    362364    thread->ReleaseQuiet();
    363     thread = 0;
     365    thread = nsnull;
    364366}
    365367
    366368/*static*/ void nsExceptionService::DropThread(nsExceptionManager *thread)

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy