Fix dangling kernel objects when exiting
This commit is contained in:
parent
052017e189
commit
dd29285e35
@ -434,11 +434,6 @@ void KProcess::PrepareForTermination() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void KProcess::Finalize() {
|
void KProcess::Finalize() {
|
||||||
// Release memory to the resource limit.
|
|
||||||
if (resource_limit != nullptr) {
|
|
||||||
resource_limit->Close();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Finalize the handle table and close any open handles.
|
// Finalize the handle table and close any open handles.
|
||||||
handle_table.Finalize();
|
handle_table.Finalize();
|
||||||
|
|
||||||
@ -460,6 +455,12 @@ void KProcess::Finalize() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Release memory to the resource limit.
|
||||||
|
if (resource_limit != nullptr) {
|
||||||
|
resource_limit->Close();
|
||||||
|
resource_limit = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
// Perform inherited finalization.
|
// Perform inherited finalization.
|
||||||
KAutoObjectWithSlabHeapAndContainer<KProcess, KSynchronizationObject>::Finalize();
|
KAutoObjectWithSlabHeapAndContainer<KProcess, KSynchronizationObject>::Finalize();
|
||||||
}
|
}
|
||||||
|
@ -91,12 +91,6 @@ struct KernelCore::Impl {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Shutdown() {
|
void Shutdown() {
|
||||||
// Shutdown all processes.
|
|
||||||
if (current_process) {
|
|
||||||
current_process->Finalize();
|
|
||||||
current_process->Close();
|
|
||||||
current_process = nullptr;
|
|
||||||
}
|
|
||||||
process_list.clear();
|
process_list.clear();
|
||||||
|
|
||||||
// Close all open server ports.
|
// Close all open server ports.
|
||||||
@ -181,6 +175,13 @@ struct KernelCore::Impl {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Shutdown all processes.
|
||||||
|
if (current_process) {
|
||||||
|
current_process->Finalize();
|
||||||
|
current_process->Close();
|
||||||
|
current_process = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
// Track kernel objects that were not freed on shutdown
|
// Track kernel objects that were not freed on shutdown
|
||||||
{
|
{
|
||||||
std::lock_guard lk(registered_objects_lock);
|
std::lock_guard lk(registered_objects_lock);
|
||||||
|
Loading…
Reference in New Issue
Block a user