mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 12:38:12 +00:00
Kernel: Switch singletons to use new Singleton class
MemoryManager cannot use the Singleton class because MemoryManager::initialize is called before the global constructors are run. That caused the Singleton to be re-initialized, causing it to create another MemoryManager instance. Fixes #3226
This commit is contained in:
parent
ba6e4fb77f
commit
d89582880e
46 changed files with 221 additions and 170 deletions
|
@ -25,6 +25,7 @@
|
|||
*/
|
||||
|
||||
#include <AK/Memory.h>
|
||||
#include <AK/Singleton.h>
|
||||
#include <Kernel/Devices/PS2MouseDevice.h>
|
||||
#include <Kernel/Devices/VMWareBackdoor.h>
|
||||
#include <Kernel/IO.h>
|
||||
|
@ -56,13 +57,12 @@ namespace Kernel {
|
|||
|
||||
//#define PS2MOUSE_DEBUG
|
||||
|
||||
static PS2MouseDevice* s_the;
|
||||
static AK::Singleton<PS2MouseDevice> s_the;
|
||||
|
||||
PS2MouseDevice::PS2MouseDevice()
|
||||
: IRQHandler(IRQ_MOUSE)
|
||||
, CharacterDevice(10, 1)
|
||||
{
|
||||
s_the = this;
|
||||
initialize();
|
||||
}
|
||||
|
||||
|
@ -70,6 +70,11 @@ PS2MouseDevice::~PS2MouseDevice()
|
|||
{
|
||||
}
|
||||
|
||||
void PS2MouseDevice::create()
|
||||
{
|
||||
s_the.ensure_instance();
|
||||
}
|
||||
|
||||
PS2MouseDevice& PS2MouseDevice::the()
|
||||
{
|
||||
return *s_the;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue