Merge pull request #9398 from liamwhite/fail

general: improve handling of system startup failure
This commit is contained in:
bunnei 2022-12-12 14:37:42 -08:00 committed by GitHub
commit 339a37f8cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 27 additions and 21 deletions

View file

@ -104,12 +104,16 @@ struct KernelCore::Impl {
}
void CloseCurrentProcess() {
(*current_process).Finalize();
// current_process->Close();
// TODO: The current process should be destroyed based on accurate ref counting after
KProcess* old_process = current_process.exchange(nullptr);
if (old_process == nullptr) {
return;
}
// old_process->Close();
// TODO: The process should be destroyed based on accurate ref counting after
// calling Close(). Adding a manual Destroy() call instead to avoid a memory leak.
(*current_process).Destroy();
current_process = nullptr;
old_process->Finalize();
old_process->Destroy();
}
void Shutdown() {