From 41b07672e0ec82ea7adbc484ebd8477e5fe9a145 Mon Sep 17 00:00:00 2001 From: Emiel Bruijntjes Date: Tue, 10 Nov 2015 15:29:25 +0100 Subject: [PATCH] fixed possible crash when connection was destructed while it was still busy resolving the domain name --- src/tcpresolver.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tcpresolver.h b/src/tcpresolver.h index 53489f1..0739477 100644 --- a/src/tcpresolver.h +++ b/src/tcpresolver.h @@ -152,6 +152,9 @@ public: { // stop monitoring the pipe filedescriptor _handler->monitor(_connection, _pipe.in(), 0); + + // wait for the thread to be ready + _thread.join(); } /** @@ -165,9 +168,6 @@ public: // only works if the incoming pipe is readable if (fd != _pipe.in() || !(flags & readable)) return this; - // wait for the thread to be ready - _thread.join(); - // do we have a valid socket? if (_socket >= 0) return new TcpConnected(_connection, _socket, std::move(_buffer), _handler);