diff options
author | Tom <tomut@yahoo.com> | 2020-08-24 19:35:19 -0600 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-08-25 09:48:48 +0200 |
commit | d89582880ed81c38df67687eadfc0764b6ce5ddd (patch) | |
tree | 3ff52c4e8808c5167ee37d5bf0a6669e9a18dfb4 /Kernel/FileSystem/FileSystem.cpp | |
parent | ba6e4fb77f00587d2bd57865a00b1a4526684741 (diff) | |
download | serenity-d89582880ed81c38df67687eadfc0764b6ce5ddd.zip |
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
Diffstat (limited to 'Kernel/FileSystem/FileSystem.cpp')
-rw-r--r-- | Kernel/FileSystem/FileSystem.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/Kernel/FileSystem/FileSystem.cpp b/Kernel/FileSystem/FileSystem.cpp index e4ed6fd98b..49f1b284f3 100644 --- a/Kernel/FileSystem/FileSystem.cpp +++ b/Kernel/FileSystem/FileSystem.cpp @@ -26,6 +26,7 @@ #include <AK/Assertions.h> #include <AK/HashMap.h> +#include <AK/Singleton.h> #include <AK/StringBuilder.h> #include <AK/StringView.h> #include <Kernel/FileSystem/FileSystem.h> @@ -37,12 +38,10 @@ namespace Kernel { static u32 s_lastFileSystemID; -static HashMap<u32, FS*>* s_fs_map; +static AK::Singleton<HashMap<u32, FS*>> s_fs_map; static HashMap<u32, FS*>& all_fses() { - if (!s_fs_map) - s_fs_map = new HashMap<u32, FS*>(); return *s_fs_map; } |