diff --git a/Kernel/FileSystem/BlockBasedFileSystem.cpp b/Kernel/FileSystem/BlockBasedFileSystem.cpp index 4e78a5d3ed..1dabaecf00 100644 --- a/Kernel/FileSystem/BlockBasedFileSystem.cpp +++ b/Kernel/FileSystem/BlockBasedFileSystem.cpp @@ -101,11 +101,14 @@ public: private: mutable NonnullRefPtr m_fs; + NonnullOwnPtr m_cached_block_data; + + // NOTE: m_entries must be declared before m_dirty_list and m_clean_list because their entries are allocated from it. + // We need to ensure that the destructors of m_dirty_list and m_clean_list are called before m_entries is destroyed. + NonnullOwnPtr m_entries; mutable IntrusiveList<&CacheEntry::list_node> m_dirty_list; mutable IntrusiveList<&CacheEntry::list_node> m_clean_list; mutable HashMap m_hash; - NonnullOwnPtr m_cached_block_data; - NonnullOwnPtr m_entries; }; BlockBasedFileSystem::BlockBasedFileSystem(OpenFileDescription& file_description)