mirror of
https://github.com/unicode-org/icu.git
synced 2025-04-13 00:43:32 +00:00
ICU-20776 Checks for nullness in UMutex::lock()
Adds `U_ASSERT` check before using `m->lock()` to make allocation issues more apparent at least in debug builds. There is probably quite a few places like this, but let's try fixing broken windows.
This commit is contained in:
parent
c5ad4664f9
commit
0a01b29005
2 changed files with 3 additions and 1 deletions
icu4c/source/common
|
@ -98,6 +98,7 @@ std::mutex *UMutex::getMutex() {
|
|||
gListHead = this;
|
||||
}
|
||||
}
|
||||
U_ASSERT(retPtr != nullptr);
|
||||
return retPtr;
|
||||
}
|
||||
|
||||
|
|
|
@ -240,7 +240,8 @@ private:
|
|||
static UMutex *gListHead;
|
||||
|
||||
/** Out-of-line function to lazily initialize a UMutex on first use.
|
||||
* Initial fast check is inline, in lock().
|
||||
* Initial fast check is inline, in lock(). The returned value may never
|
||||
* be nullptr.
|
||||
*/
|
||||
std::mutex *getMutex();
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue