Ticket #15568: exceptionservice.diff
| File exceptionservice.diff, 2.9 KB (added by , 8 years ago) |
|---|
-
src/libs/xpcom18a4/xpcom/base/nsExceptionService.cpp
83 83 84 84 #ifdef NS_DEBUG 85 85 inline nsrefcnt ReleaseQuiet() { 86 // shut up NS_ASSERT_OWNINGTHREAD (see expla ination below)86 // shut up NS_ASSERT_OWNINGTHREAD (see explanation below) 87 87 nsAutoOwningThread old = _mOwningThread; 88 88 _mOwningThread = nsAutoOwningThread(); 89 89 nsrefcnt ref = Release(); … … 114 114 // instance on creation). In both cases, there should be no other threads 115 115 // holding objects (i.e. it's thread-safe to call them), but 116 116 // NS_CheckThreadSafe() assertions will still happen and yell in the debug 117 // build. Since it is quite annoying, we use a special ReleaseQuiet() me htod117 // build. Since it is quite annoying, we use a special ReleaseQuiet() method 118 118 // in DoDropThread() to shut them up. 119 119 NS_IMPL_THREADSAFE_ISUPPORTS1(nsExceptionManager, nsIExceptionManager) 120 120 … … 164 164 /* The Exception Service */ 165 165 166 166 PRUintn nsExceptionService::tlsIndex = BAD_TLS_INDEX; 167 PRLock *nsExceptionService::lock = PR_FALSE;167 PRLock *nsExceptionService::lock = nsnull; 168 168 nsExceptionManager *nsExceptionService::firstThread = nsnull; 169 169 170 170 #ifdef NS_DEBUG … … 200 200 nsExceptionService::~nsExceptionService() 201 201 { 202 202 Shutdown(); 203 if (lock) { 204 PRLock *tmp = lock; 205 lock = nsnull; 206 PR_DestroyLock(tmp); 207 } 203 208 /* destructor code */ 204 209 #ifdef NS_DEBUG 205 210 PR_AtomicDecrement(&totalInstances); … … 210 215 void nsExceptionService::ThreadDestruct( void *data ) 211 216 { 212 217 if (!lock) { 213 // a typical situation is when IPC worker threads that have instantiated214 // exception managers are stopped after nsExceptionService is shut down,215 // which will result into this warning. disable it.216 #if 0217 218 NS_WARNING("nsExceptionService ignoring thread destruction after shutdown"); 218 #endif219 219 return; 220 220 } 221 221 DropThread( (nsExceptionManager *)data ); … … 224 224 225 225 void nsExceptionService::Shutdown() 226 226 { 227 PR_SetThreadPrivate(tlsIndex, nsnull); 227 228 mProviders.Reset(); 228 229 if (lock) { 229 230 DropAllThreads(); 230 PR_DestroyLock(lock);231 lock = nsnull;232 231 } 233 PR_SetThreadPrivate(tlsIndex, nsnull);234 232 } 235 233 236 234 /* void setCurrentException (in nsIException error); */ … … 355 353 { 356 354 nsExceptionManager **emp = &firstThread; 357 355 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 } 359 361 emp = &(*emp)->mNextThread; 360 362 } 361 363 *emp = thread->mNextThread; 362 364 thread->ReleaseQuiet(); 363 thread = 0;365 thread = nsnull; 364 366 } 365 367 366 368 /*static*/ void nsExceptionService::DropThread(nsExceptionManager *thread)

