mirror of
https://github.com/RGBCube/serenity
synced 2025-05-22 15:05:07 +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 {
|
namespace AK {
|
||||||
|
|
||||||
|
static StringImpl* s_theEmptyStringImpl = nullptr;
|
||||||
|
|
||||||
|
void StringImpl::initializeGlobals()
|
||||||
|
{
|
||||||
|
s_theEmptyStringImpl = new StringImpl(ConstructTheEmptyStringImpl);;
|
||||||
|
}
|
||||||
|
|
||||||
StringImpl& StringImpl::theEmptyStringImpl()
|
StringImpl& StringImpl::theEmptyStringImpl()
|
||||||
{
|
{
|
||||||
static StringImpl* s = nullptr;
|
ASSERT(s_theEmptyStringImpl);
|
||||||
if (!s)
|
return *s_theEmptyStringImpl;
|
||||||
s = new StringImpl(ConstructTheEmptyStringImpl);
|
|
||||||
return *s;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
StringImpl::~StringImpl()
|
StringImpl::~StringImpl()
|
||||||
|
|
|
@ -15,6 +15,7 @@ public:
|
||||||
RetainPtr<StringImpl> toUppercase() const;
|
RetainPtr<StringImpl> toUppercase() const;
|
||||||
|
|
||||||
static StringImpl& theEmptyStringImpl();
|
static StringImpl& theEmptyStringImpl();
|
||||||
|
static void initializeGlobals();
|
||||||
|
|
||||||
~StringImpl();
|
~StringImpl();
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#include "Console.h"
|
#include "Console.h"
|
||||||
|
|
||||||
#define TEST_VFS
|
#define TEST_VFS
|
||||||
//#define TEST_ELF_LOADER
|
#define TEST_ELF_LOADER
|
||||||
//#define TEST_CRASHY_USER_PROCESSES
|
//#define TEST_CRASHY_USER_PROCESSES
|
||||||
|
|
||||||
static void motd_main() NORETURN;
|
static void motd_main() NORETURN;
|
||||||
|
@ -102,8 +102,6 @@ static void init_stage2()
|
||||||
// Anything that registers interrupts goes *after* PIC and IDT for obvious reasons.
|
// Anything that registers interrupts goes *after* PIC and IDT for obvious reasons.
|
||||||
Syscall::initialize();
|
Syscall::initialize();
|
||||||
|
|
||||||
VirtualFileSystem::initializeGlobals();
|
|
||||||
|
|
||||||
extern void panel_main();
|
extern void panel_main();
|
||||||
|
|
||||||
new Task(panel_main, "panel", IPC::Handle::PanelTask, Task::Ring0);
|
new Task(panel_main, "panel", IPC::Handle::PanelTask, Task::Ring0);
|
||||||
|
@ -203,6 +201,9 @@ void init()
|
||||||
|
|
||||||
MemoryManager::initialize();
|
MemoryManager::initialize();
|
||||||
|
|
||||||
|
VirtualFileSystem::initializeGlobals();
|
||||||
|
StringImpl::initializeGlobals();
|
||||||
|
|
||||||
auto keyboard = make<Keyboard>();
|
auto keyboard = make<Keyboard>();
|
||||||
|
|
||||||
PIT::initialize();
|
PIT::initialize();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue