mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 09:38:11 +00:00
Oops, StringImpl's "the empty string" global was not always initialized.
These "oops forgot to initialize" bugs are getting annoying...
This commit is contained in:
parent
c5e55f4737
commit
702d308e67
3 changed files with 14 additions and 7 deletions
|
@ -4,12 +4,17 @@
|
|||
|
||||
namespace AK {
|
||||
|
||||
static StringImpl* s_theEmptyStringImpl = nullptr;
|
||||
|
||||
void StringImpl::initializeGlobals()
|
||||
{
|
||||
s_theEmptyStringImpl = new StringImpl(ConstructTheEmptyStringImpl);;
|
||||
}
|
||||
|
||||
StringImpl& StringImpl::theEmptyStringImpl()
|
||||
{
|
||||
static StringImpl* s = nullptr;
|
||||
if (!s)
|
||||
s = new StringImpl(ConstructTheEmptyStringImpl);
|
||||
return *s;
|
||||
ASSERT(s_theEmptyStringImpl);
|
||||
return *s_theEmptyStringImpl;
|
||||
}
|
||||
|
||||
StringImpl::~StringImpl()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue