diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2021-10-15 16:12:21 +0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2021-10-15 16:12:21 +0200 |
commit | e0936ae38f110db68870b1d80d6c628172d12b4c (patch) | |
tree | 5e921048d9e08636a6b0078b7e43e697505e81ae /src/libstore/gc.cc | |
parent | 4d014221d4aaf9c2e7a323be002f058ebb4d79e2 (diff) |
Fix crash when a GC client disconnects
The client thread can't just delete its own thread object from
connections, it has to detach it.
Diffstat (limited to 'src/libstore/gc.cc')
-rw-r--r-- | src/libstore/gc.cc | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libstore/gc.cc b/src/libstore/gc.cc index ed792a777..220441927 100644 --- a/src/libstore/gc.cc +++ b/src/libstore/gc.cc @@ -536,7 +536,10 @@ void LocalStore::collectGarbage(const GCOptions & options, GCResults & results) auto fdClient_ = fdClient.get(); std::thread clientThread([&, fdClient = std::move(fdClient)]() { Finally cleanup([&]() { - connections.lock()->erase(fdClient.get()); + auto conn(connections.lock()); + auto i = conn->find(fdClient.get()); + i->second.detach(); + conn->erase(i); }); while (true) { |