summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/client_session.cpp
diff options
context:
space:
mode:
authorYuri Kunde Schlesner <yuriks@yuriks.net>2017-06-08 09:33:24 +0200
committerYuri Kunde Schlesner <yuriks@yuriks.net>2017-06-08 09:33:24 +0200
commitd666e01cdf2cbeb0ab55b69c8c4558e5fb6c3d2c (patch)
tree482da3eef1f81f7c25d3f84e921bbc408a3559d8 /src/core/hle/kernel/client_session.cpp
parentMerge pull request #2737 from Subv/decryptbeacondata (diff)
downloadyuzu-d666e01cdf2cbeb0ab55b69c8c4558e5fb6c3d2c.tar
yuzu-d666e01cdf2cbeb0ab55b69c8c4558e5fb6c3d2c.tar.gz
yuzu-d666e01cdf2cbeb0ab55b69c8c4558e5fb6c3d2c.tar.bz2
yuzu-d666e01cdf2cbeb0ab55b69c8c4558e5fb6c3d2c.tar.lz
yuzu-d666e01cdf2cbeb0ab55b69c8c4558e5fb6c3d2c.tar.xz
yuzu-d666e01cdf2cbeb0ab55b69c8c4558e5fb6c3d2c.tar.zst
yuzu-d666e01cdf2cbeb0ab55b69c8c4558e5fb6c3d2c.zip
Diffstat (limited to 'src/core/hle/kernel/client_session.cpp')
-rw-r--r--src/core/hle/kernel/client_session.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/core/hle/kernel/client_session.cpp b/src/core/hle/kernel/client_session.cpp
index 6bc49ff64..5ac427bdb 100644
--- a/src/core/hle/kernel/client_session.cpp
+++ b/src/core/hle/kernel/client_session.cpp
@@ -16,9 +16,13 @@ ClientSession::~ClientSession() {
// This destructor will be called automatically when the last ClientSession handle is closed by
// the emulated application.
- if (parent->server) {
- if (parent->server->hle_handler)
- parent->server->hle_handler->ClientDisconnected(parent->server);
+ // Local references to ServerSession and SessionRequestHandler are necessary to guarantee they
+ // will be kept alive until after ClientDisconnected() returns.
+ SharedPtr<ServerSession> server = parent->server;
+ if (server) {
+ std::shared_ptr<SessionRequestHandler> hle_handler = server->hle_handler;
+ if (hle_handler)
+ hle_handler->ClientDisconnected(server);
// TODO(Subv): Force a wake up of all the ServerSession's waiting threads and set
// their WaitSynchronization result to 0xC920181A.
@@ -28,11 +32,13 @@ ClientSession::~ClientSession() {
}
ResultCode ClientSession::SendSyncRequest() {
- // Signal the server session that new data is available
- if (parent->server)
- return parent->server->HandleSyncRequest();
+ // Keep ServerSession alive until we're done working with it.
+ SharedPtr<ServerSession> server = parent->server;
+ if (server == nullptr)
+ return ERR_SESSION_CLOSED_BY_REMOTE;
- return ERR_SESSION_CLOSED_BY_REMOTE;
+ // Signal the server session that new data is available
+ return server->HandleSyncRequest();
}
} // namespace