From 426a8909e19b45d217e5ba35e62fd5a434f20c63 Mon Sep 17 00:00:00 2001 From: Stephen Birarda Date: Tue, 18 Aug 2015 09:40:13 -0700 Subject: [PATCH] wait on the SendQueue thread in Connection --- libraries/networking/src/udt/Connection.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/libraries/networking/src/udt/Connection.cpp b/libraries/networking/src/udt/Connection.cpp index e07d987c4a..d8aee60432 100644 --- a/libraries/networking/src/udt/Connection.cpp +++ b/libraries/networking/src/udt/Connection.cpp @@ -47,9 +47,16 @@ Connection::Connection(Socket* parentSocket, HifiSockAddr destination, std::uniq Connection::~Connection() { if (_sendQueue) { + // grab the send queue thread so we can wait on it + QThread* sendQueueThread = _sendQueue->thread(); + + // tell the send queue to stop and be deleted _sendQueue->stop(); _sendQueue->deleteLater(); _sendQueue.release(); + + // wait on the send queue thread so we know the send queue is gone + sendQueueThread->wait(); } }