We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 59a3ba7 commit 66a2293Copy full SHA for 66a2293
.gitignore
@@ -4,4 +4,5 @@
4
.vs/
5
.DS_Store
6
.idea/
7
-cmake-build-*/
+cmake-build-*/
8
+.cache/
src/rpc-connection.hpp
@@ -35,7 +35,9 @@ namespace discord {
35
class Connection {
36
private:
37
Connection() noexcept = default;
38
- ~Connection() noexcept = default;
+ ~Connection() noexcept {
39
+ this->close();
40
+ }
41
42
public:
43
static Connection& get() noexcept {
@@ -142,6 +144,10 @@ namespace discord {
142
144
}
143
145
146
void close() {
147
+ if (m_state == State::Disconnected) {
148
+ return;
149
150
+
151
RPCManager::get().invokeOnDisconnected(toInt(m_lastError), m_lastErrorMessage);
152
platform::PipeConnection::get().close();
153
m_state = State::Disconnected;
0 commit comments