summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@nokia.com>2010-04-09 14:13:57 (GMT)
committerJoerg Bornemann <joerg.bornemann@nokia.com>2010-04-12 12:33:23 (GMT)
commit059bf03f30c0e27830d311ae9a664eb0376fcd1f (patch)
treebd6a118a36ff1a47a58f1a1a9efc4dfcef2d6936 /src/network
parent1bcbd8aa87db82f045b935861510ee7480578f04 (diff)
downloadQt-059bf03f30c0e27830d311ae9a664eb0376fcd1f.zip
Qt-059bf03f30c0e27830d311ae9a664eb0376fcd1f.tar.gz
Qt-059bf03f30c0e27830d311ae9a664eb0376fcd1f.tar.bz2
fix closing state in QLocalSocket on Windows
When closing a QLocalSocket, which has unwritten data, the pipe writer was never deleted. Thus writing after a reconnect didn't work. Task-number: QTBUG-9681 Reviewed-by: ossi
Diffstat (limited to 'src/network')
-rw-r--r--src/network/socket/qlocalsocket_win.cpp10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/network/socket/qlocalsocket_win.cpp b/src/network/socket/qlocalsocket_win.cpp
index 3283bf2..5f46ecb 100644
--- a/src/network/socket/qlocalsocket_win.cpp
+++ b/src/network/socket/qlocalsocket_win.cpp
@@ -39,7 +39,6 @@
**
****************************************************************************/
-#include "qlocalsocket.h"
#include "qlocalsocket_p.h"
#include <private/qthread_p.h>
@@ -425,6 +424,15 @@ bool QLocalSocket::flush()
void QLocalSocket::disconnectFromServer()
{
Q_D(QLocalSocket);
+
+ // Are we still connected?
+ if (!isValid()) {
+ // If we have unwritten data, the pipeWriter is still present.
+ // It must be destroyed before close() to prevent an infinite loop.
+ delete d->pipeWriter;
+ d->pipeWriter = 0;
+ }
+
flush();
if (d->pipeWriter && d->pipeWriter->bytesToWrite() != 0) {
d->state = QLocalSocket::ClosingState;