diff options
author | Brendan Coles <bcoles@gmail.com> | 2021-10-23 11:47:34 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-10-23 13:57:36 +0200 |
commit | f4c181da9dfd27bf0686fcfe10593e6d0f70cbd7 (patch) | |
tree | e218f1de6bea0cd410df552fdd9b113e46a65c33 /Userland/Services/TelnetServer | |
parent | f645ed199e89c947f2ed0081f9c3c8f9639973a9 (diff) | |
download | serenity-f4c181da9dfd27bf0686fcfe10593e6d0f70cbd7.zip |
TelnetServer: Defer removal of client from clients HashMap
This is necessary to avoid trying to destruct the on_ready_to_read
function from inside the function.
Diffstat (limited to 'Userland/Services/TelnetServer')
-rw-r--r-- | Userland/Services/TelnetServer/main.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Userland/Services/TelnetServer/main.cpp b/Userland/Services/TelnetServer/main.cpp index 663a07b4e5..c2771048d2 100644 --- a/Userland/Services/TelnetServer/main.cpp +++ b/Userland/Services/TelnetServer/main.cpp @@ -135,7 +135,9 @@ int main(int argc, char** argv) run_command(ptm_fd, command); auto client = Client::create(id, move(client_socket), ptm_fd); - client->on_exit = [&clients, id] { clients.remove(id); }; + client->on_exit = [&clients, id] { + Core::deferred_invoke([&clients, id] { clients.remove(id); }); + }; clients.set(id, client); }; |