diff --git a/Userland/Services/ImageDecoder/ClientConnection.cpp b/Userland/Services/ImageDecoder/ClientConnection.cpp index 2522d7bba1..6b8ec20faf 100644 --- a/Userland/Services/ImageDecoder/ClientConnection.cpp +++ b/Userland/Services/ImageDecoder/ClientConnection.cpp @@ -12,12 +12,9 @@ namespace ImageDecoder { -static HashMap> s_connections; - -ClientConnection::ClientConnection(NonnullRefPtr socket, int client_id) - : IPC::ClientConnection(*this, move(socket), client_id) +ClientConnection::ClientConnection(NonnullRefPtr socket) + : IPC::ClientConnection(*this, move(socket), 1) { - s_connections.set(client_id, *this); } ClientConnection::~ClientConnection() @@ -26,8 +23,7 @@ ClientConnection::~ClientConnection() void ClientConnection::die() { - s_connections.remove(client_id()); - exit(0); + Core::EventLoop::current().quit(0); } Messages::ImageDecoderServer::DecodeImageResponse ClientConnection::decode_image(Core::AnonymousBuffer const& encoded_buffer) diff --git a/Userland/Services/ImageDecoder/ClientConnection.h b/Userland/Services/ImageDecoder/ClientConnection.h index 3c1efc7512..01cb037c7a 100644 --- a/Userland/Services/ImageDecoder/ClientConnection.h +++ b/Userland/Services/ImageDecoder/ClientConnection.h @@ -25,7 +25,7 @@ public: virtual void die() override; private: - explicit ClientConnection(NonnullRefPtr, int client_id); + explicit ClientConnection(NonnullRefPtr); virtual Messages::ImageDecoderServer::DecodeImageResponse decode_image(Core::AnonymousBuffer const&) override; }; diff --git a/Userland/Services/ImageDecoder/main.cpp b/Userland/Services/ImageDecoder/main.cpp index 7af4cbacc7..a273ce20ae 100644 --- a/Userland/Services/ImageDecoder/main.cpp +++ b/Userland/Services/ImageDecoder/main.cpp @@ -18,7 +18,7 @@ ErrorOr serenity_main(Main::Arguments) TRY(Core::System::unveil(nullptr, nullptr)); auto socket = TRY(Core::LocalSocket::take_over_accepted_socket_from_system_server()); - IPC::new_client_connection(move(socket), 1); + auto client = IPC::new_client_connection(move(socket)); TRY(Core::System::pledge("stdio recvfd sendfd")); return event_loop.exec(); }