kernel: Fix AddressSpace's move assignment operator
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
parent
c599251d2a
commit
ae0cd155c3
@ -70,11 +70,14 @@ AddressSpace& AddressSpace::operator=(AddressSpace&& other)
|
||||
if (&other == this) return *this;
|
||||
|
||||
m_regions.consume([](VMRegion* region) { delete region; });
|
||||
MMU::delete_userspace_page_directory(m_directory);
|
||||
if (m_directory) MMU::delete_userspace_page_directory(m_directory);
|
||||
|
||||
m_regions = other.m_regions;
|
||||
m_directory = other.m_directory;
|
||||
|
||||
other.m_regions.reset();
|
||||
other.m_directory = nullptr;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
@ -215,5 +218,5 @@ Result<VMRegion*> AddressSpace::split_region(VMRegion* parent, u64 boundary)
|
||||
AddressSpace::~AddressSpace()
|
||||
{
|
||||
m_regions.consume([](VMRegion* region) { delete region; });
|
||||
MMU::delete_userspace_page_directory(m_directory);
|
||||
if (m_directory) MMU::delete_userspace_page_directory(m_directory);
|
||||
}
|
||||
|
@ -251,6 +251,12 @@ template <typename T> class LinkedList
|
||||
return { nullptr, *this };
|
||||
}
|
||||
|
||||
void reset()
|
||||
{
|
||||
m_start_node = m_end_node = nullptr;
|
||||
m_count = 0;
|
||||
}
|
||||
|
||||
private:
|
||||
Node* m_start_node = nullptr;
|
||||
Node* m_end_node = nullptr;
|
||||
|
Loading…
Reference in New Issue
Block a user