Compare commits

...

5 Commits

5 changed files with 17 additions and 3 deletions

View File

@@ -44,7 +44,7 @@ bool SessionRequestManager::HasSessionRequestHandler(const HLERequestContext& co
LOG_CRITICAL(IPC, "object_id {} is too big!", object_id);
return false;
}
return DomainHandler(object_id - 1).lock() != nullptr;
return !DomainHandler(object_id - 1).expired();
} else {
return session_handler != nullptr;
}

View File

@@ -134,7 +134,7 @@ public:
void CloseDomainHandler(std::size_t index) {
if (index < DomainHandlerCount()) {
domain_handlers[index] = nullptr;
domain_handlers[index].reset();
} else {
UNREACHABLE_MSG("Unexpected handler index {}", index);
}

View File

@@ -37,6 +37,11 @@ ResultCode KThreadLocalPage::Initialize(KernelCore& kernel, KProcess* process) {
}
ResultCode KThreadLocalPage::Finalize() {
// If we are actively shutting down, there is nothing to do here.
if (m_kernel->IsShuttingDown()) {
return ResultSuccess;
}
// Get the physical address of the page.
const PAddr phys_addr = m_owner->PageTable().GetPhysicalAddr(m_virt_addr);
ASSERT(phys_addr);

View File

@@ -176,15 +176,24 @@ struct KernelCore::Impl {
}
// Track kernel objects that were not freed on shutdown
std::unordered_set<KAutoObject*> registered_objects_;
{
std::lock_guard lk(registered_objects_lock);
// Log and clear dangling objects if necessary.
if (registered_objects.size()) {
LOG_DEBUG(Kernel, "{} kernel objects were dangling on shutdown!",
registered_objects.size());
registered_objects_ = registered_objects;
registered_objects.clear();
}
}
// Attempt to close open references.
for (auto* object : registered_objects_) {
object->Close();
}
// Ensure that the object list container is finalized and properly shutdown.
global_object_list_container->Finalize();
global_object_list_container.reset();

View File

@@ -79,7 +79,7 @@ public:
this->Finalize();
}
Free(kernel, static_cast<Derived*>(this));
if (is_initialized) {
if (is_initialized && !kernel.IsShuttingDown()) {
Derived::PostDestroy(arg);
}
}