mirror of
https://github.com/RetroDECK/Duckstation.git
synced 2025-02-16 19:05:39 +00:00
dep/discord-rpc: Ensure the cleared presence gets sent at shutdown
This commit is contained in:
parent
d4214211a2
commit
6b2ce266d4
|
@ -355,13 +355,20 @@ extern "C" DISCORD_EXPORT void Discord_Shutdown(void)
|
||||||
Connection->onConnect = nullptr;
|
Connection->onConnect = nullptr;
|
||||||
Connection->onDisconnect = nullptr;
|
Connection->onDisconnect = nullptr;
|
||||||
Handlers = {};
|
Handlers = {};
|
||||||
|
if (IoThread != nullptr) {
|
||||||
|
IoThread->Stop();
|
||||||
|
delete IoThread;
|
||||||
|
IoThread = nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
// HACK: We need to send the updated (cleared) presence, but we're shutting down.
|
||||||
|
// Force an update, wait 100ms for it to clear (hopefully this will be long enough), and get any responses.
|
||||||
|
Discord_UpdateConnection();
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||||
|
Discord_UpdateConnection();
|
||||||
|
|
||||||
QueuedPresence.length = 0;
|
QueuedPresence.length = 0;
|
||||||
UpdatePresence.exchange(false);
|
UpdatePresence.exchange(false);
|
||||||
if (IoThread != nullptr) {
|
|
||||||
IoThread->Stop();
|
|
||||||
delete IoThread;
|
|
||||||
IoThread = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
RpcConnection::Destroy(Connection);
|
RpcConnection::Destroy(Connection);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue