QmlDebugging: make sure that all data is sent on close
authorChristiaan Janssen <christiaan.janssen@nokia.com>
Tue, 8 May 2012 12:21:45 +0000 (14:21 +0200)
committerQt by Nokia <qt-info@nokia.com>
Tue, 8 May 2012 20:36:35 +0000 (22:36 +0200)
Change-Id: I662a3865fec1e4d12d57389bfbe23d7221b6df16
Reviewed-by: Aurindam Jana <aurindam.jana@nokia.com>
Reviewed-by: Kai Koehne <kai.koehne@nokia.com>
src/plugins/qmltooling/qmldbg_tcp/qtcpserverconnection.cpp

index 724155a..e747a8d 100644 (file)
@@ -82,6 +82,8 @@ QTcpServerConnection::QTcpServerConnection() :
 
 QTcpServerConnection::~QTcpServerConnection()
 {
+    if (isConnected())
+        disconnect();
     delete d_ptr;
 }
 
@@ -117,6 +119,9 @@ void QTcpServerConnection::disconnect()
 {
     Q_D(QTcpServerConnection);
 
+    while (d->socket && d->socket->bytesToWrite() > 0)
+        d->socket->waitForBytesWritten();
+
     // protocol might still be processing packages at this point
     d->protocol->deleteLater();
     d->protocol = 0;