diff options
| author | Rusty Wagner <rusty.wagner@gmail.com> | 2023-01-31 21:45:23 -0500 |
|---|---|---|
| committer | Alexander Taylor <alex@vector35.com> | 2023-02-08 11:53:38 -0500 |
| commit | c2247a35e97c96eba9cd4caf09b32b038625cc31 (patch) | |
| tree | d88022f286bd811667f88cc3926dada7b4ec5d31 /websocketprovider.cpp | |
| parent | 0b752f36c9d3b6bcb51a05fdcf5b38633d38bdbd (diff) | |
Clean up possible early deletion issues in API callbacks
Diffstat (limited to 'websocketprovider.cpp')
| -rw-r--r-- | websocketprovider.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/websocketprovider.cpp b/websocketprovider.cpp index 48782715..52b8e721 100644 --- a/websocketprovider.cpp +++ b/websocketprovider.cpp @@ -59,28 +59,28 @@ bool WebsocketClient::ConnectCallback( headers[headerKeys[i]] = headerValues[i]; } - WebsocketClient* client = (WebsocketClient*)ctxt; + CallbackRef<WebsocketClient> client(ctxt); return client->Connect(host, headers); } bool WebsocketClient::DisconnectCallback(void* ctxt) { - WebsocketClient* client = (WebsocketClient*)ctxt; + CallbackRef<WebsocketClient> client(ctxt); return client->Disconnect(); } void WebsocketClient::ErrorCallback(const char* msg, void* ctxt) { - WebsocketClient* client = (WebsocketClient*)ctxt; + CallbackRef<WebsocketClient> client(ctxt); BNNotifyWebsocketClientError(client->m_object, msg); } bool WebsocketClient::WriteCallback(const uint8_t* data, uint64_t len, void* ctxt) { - WebsocketClient* client = (WebsocketClient*)ctxt; + CallbackRef<WebsocketClient> client(ctxt); return client->Write(vector<uint8_t>(data, data + len)); } |
