mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-25 11:58:55 +00:00
Bug 1251895 - don't race on nsTraceRefcnt's object serial number tables; r=mccr8
GetSerialNumber accesses global state through gSerialNumbers. We call GetSerialNumber under a lock when doing normal object refcount logging. However, we call GetSerialNumber outside of a lock when we're tracing individual classes for nsCOMPtr refcount logging, even if we don't actually care about nsCOMPtr refcount logging. We should call it under a lock always.
This commit is contained in:
parent
2f82f5bc02
commit
4074e6e3f7
@ -1283,17 +1283,17 @@ NS_LogCOMPtrAddRef(void* aCOMPtr, nsISupports* aObject)
|
||||
if (!gTypesToLog || !gSerialNumbers) {
|
||||
return;
|
||||
}
|
||||
intptr_t serialno = GetSerialNumber(object, false);
|
||||
if (serialno == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!gInitialized) {
|
||||
InitTraceLog();
|
||||
}
|
||||
if (gLogging == FullLogging) {
|
||||
AutoTraceLogLock lock;
|
||||
|
||||
intptr_t serialno = GetSerialNumber(object, false);
|
||||
if (serialno == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t* count = GetCOMPtrCount(object);
|
||||
if (count) {
|
||||
(*count)++;
|
||||
@ -1324,17 +1324,17 @@ NS_LogCOMPtrRelease(void* aCOMPtr, nsISupports* aObject)
|
||||
if (!gTypesToLog || !gSerialNumbers) {
|
||||
return;
|
||||
}
|
||||
intptr_t serialno = GetSerialNumber(object, false);
|
||||
if (serialno == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!gInitialized) {
|
||||
InitTraceLog();
|
||||
}
|
||||
if (gLogging == FullLogging) {
|
||||
AutoTraceLogLock lock;
|
||||
|
||||
intptr_t serialno = GetSerialNumber(object, false);
|
||||
if (serialno == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
int32_t* count = GetCOMPtrCount(object);
|
||||
if (count) {
|
||||
(*count)--;
|
||||
|
Loading…
x
Reference in New Issue
Block a user