15 | | On other side thread desctuction happens via nsExceptionService::ThreadDestruct which checks that lock stil alive "if (!lock)" and trying call nsExceptionService::DropThread which use this lock. |
16 | | (!) But if lock will be destroed after checking "if (!lock)" and before using it inside DropThread, crash will happen. |
| 15 | On other side thread desctuction happens via nsExceptionService::ThreadDestruct which checks that lock stil alive "if (!lock)" and trying call nsExceptionService::DropThread which use this lock: |
| 16 | {{{ |
| 17 | void nsExceptionService::ThreadDestruct( void *data ) |
| 18 | { |
| 19 | if (!lock) { |
| 20 | // a typical situation is when IPC worker threads that have instantiated |
| 21 | // exception managers are stopped after nsExceptionService is shut down, |
| 22 | // which will result into this warning. disable it. |
| 23 | #if 0 |
| 24 | NS_WARNING("nsExceptionService ignoring thread destruction after shutdown"); |
| 25 | #endif |
| 26 | return; |
| 27 | } |
| 28 | DropThread( (nsExceptionManager *)data ); |
| 29 | } |
| 30 | |
| 31 | void nsExceptionService::DropThread(nsExceptionManager *thread) |
| 32 | { |
| 33 | PR_Lock(lock); |
| 34 | DoDropThread(thread); |
| 35 | PR_Unlock(lock); |
| 36 | } |
| 37 | }}} |
| 38 | |
| 39 | (!!!) But if lock will be destroyed after checking "if (!lock)" and before using it inside DropThread, crash will happen. |