From c3c9175a1c14cd82ea9ee9147281802f5b94013e Mon Sep 17 00:00:00 2001
From: Subv <subv2112@gmail.com>
Date: Sun, 25 Jun 2017 20:14:04 -0500
Subject: [PATCH] Kernel/Sessions: Clean up the list of pending request threads
 of a session when the client endpoint is closed.

---
 src/core/hle/kernel/client_session.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/core/hle/kernel/client_session.cpp b/src/core/hle/kernel/client_session.cpp
index 78a64d1055..e9cf057470 100644
--- a/src/core/hle/kernel/client_session.cpp
+++ b/src/core/hle/kernel/client_session.cpp
@@ -27,6 +27,11 @@ ClientSession::~ClientSession() {
 
         // TODO(Subv): Force a wake up of all the ServerSession's waiting threads and set
         // their WaitSynchronization result to 0xC920181A.
+
+        // Clean up the list of client threads with pending requests, they are unneeded now that the
+        // client endpoint is closed.
+        server->pending_requesting_threads.clear();
+        server->currently_handling = nullptr;
     }
 
     parent->client = nullptr;