diff options
author | Andreas Kling <kling@serenityos.org> | 2020-07-06 13:23:39 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-07-06 13:30:11 +0200 |
commit | 94ddb07e5884675d96a6938069fc3e83698dd898 (patch) | |
tree | be842856035e324b8907db26853dd98eba38fd26 /Services/Clipboard | |
parent | f9d3055691c98940bbf43042b1859fbf7740924d (diff) | |
download | serenity-94ddb07e5884675d96a6938069fc3e83698dd898.zip |
LibIPC+Services: Make ClientConnection take socket as NonnullRefPtr
This avoids getting into the awkward situation where the socket is
still part-owned by main() in multi-instance service. Also it just
reads nicer.
Diffstat (limited to 'Services/Clipboard')
-rw-r--r-- | Services/Clipboard/ClientConnection.cpp | 4 | ||||
-rw-r--r-- | Services/Clipboard/ClientConnection.h | 2 | ||||
-rw-r--r-- | Services/Clipboard/main.cpp | 2 |
3 files changed, 4 insertions, 4 deletions
diff --git a/Services/Clipboard/ClientConnection.cpp b/Services/Clipboard/ClientConnection.cpp index 16b882d1e9..905a8f65b4 100644 --- a/Services/Clipboard/ClientConnection.cpp +++ b/Services/Clipboard/ClientConnection.cpp @@ -41,8 +41,8 @@ void ClientConnection::for_each_client(Function<void(ClientConnection&)> callbac } } -ClientConnection::ClientConnection(Core::LocalSocket& socket, int client_id) - : IPC::ClientConnection<ClipboardServerEndpoint>(*this, socket, client_id) +ClientConnection::ClientConnection(NonnullRefPtr<Core::LocalSocket> socket, int client_id) + : IPC::ClientConnection<ClipboardServerEndpoint>(*this, move(socket), client_id) { s_connections.set(client_id, *this); } diff --git a/Services/Clipboard/ClientConnection.h b/Services/Clipboard/ClientConnection.h index 904b04abc1..857d749c29 100644 --- a/Services/Clipboard/ClientConnection.h +++ b/Services/Clipboard/ClientConnection.h @@ -37,7 +37,7 @@ class ClientConnection final : public IPC::ClientConnection<ClipboardServerEndpo C_OBJECT(ClientConnection); public: - explicit ClientConnection(Core::LocalSocket&, int client_id); + explicit ClientConnection(NonnullRefPtr<Core::LocalSocket>, int client_id); virtual ~ClientConnection() override; virtual void die() override; diff --git a/Services/Clipboard/main.cpp b/Services/Clipboard/main.cpp index 18839418b8..c46c1944eb 100644 --- a/Services/Clipboard/main.cpp +++ b/Services/Clipboard/main.cpp @@ -63,7 +63,7 @@ int main(int, char**) } static int s_next_client_id = 0; int client_id = ++s_next_client_id; - IPC::new_client_connection<Clipboard::ClientConnection>(*client_socket, client_id); + IPC::new_client_connection<Clipboard::ClientConnection>(client_socket.release_nonnull(), client_id); }; Clipboard::Storage::the().on_content_change = [&] { |