mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 16:57:35 +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/Checked.h>
|
||||
#include <AK/Singleton.h>
|
||||
#include <Kernel/Devices/BXVGADevice.h>
|
||||
#include <Kernel/IO.h>
|
||||
#include <Kernel/PCI/Access.h>
|
||||
|
@ -56,7 +57,12 @@ namespace Kernel {
|
|||
#define VBE_DISPI_ENABLED 0x01
|
||||
#define VBE_DISPI_LFB_ENABLED 0x40
|
||||
|
||||
static BXVGADevice* s_the;
|
||||
static AK::Singleton<BXVGADevice> s_the;
|
||||
|
||||
void BXVGADevice::initialize()
|
||||
{
|
||||
s_the.ensure_instance();
|
||||
}
|
||||
|
||||
BXVGADevice& BXVGADevice::the()
|
||||
{
|
||||
|
@ -67,7 +73,6 @@ BXVGADevice::BXVGADevice()
|
|||
: BlockDevice(29, 0)
|
||||
|
||||
{
|
||||
s_the = this;
|
||||
m_framebuffer_address = PhysicalAddress(find_framebuffer_address());
|
||||
set_safe_resolution();
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue