src/network/socket/qlocalsocket_win.cpp
changeset 22 79de32ba3296
parent 18 2f34d5167611
child 33 3e2da88830cd
equal deleted inserted replaced
19:fcece45ef507 22:79de32ba3296
    37 **
    37 **
    38 ** $QT_END_LICENSE$
    38 ** $QT_END_LICENSE$
    39 **
    39 **
    40 ****************************************************************************/
    40 ****************************************************************************/
    41 
    41 
    42 #include "qlocalsocket.h"
       
    43 #include "qlocalsocket_p.h"
    42 #include "qlocalsocket_p.h"
    44 
    43 
    45 #include <private/qthread_p.h>
    44 #include <private/qthread_p.h>
    46 #include <qcoreapplication.h>
    45 #include <qcoreapplication.h>
    47 #include <qdebug.h>
    46 #include <qdebug.h>
   423 }
   422 }
   424 
   423 
   425 void QLocalSocket::disconnectFromServer()
   424 void QLocalSocket::disconnectFromServer()
   426 {
   425 {
   427     Q_D(QLocalSocket);
   426     Q_D(QLocalSocket);
       
   427 
       
   428     // Are we still connected?
       
   429     if (!isValid()) {
       
   430         // If we have unwritten data, the pipeWriter is still present.
       
   431         // It must be destroyed before close() to prevent an infinite loop.
       
   432         delete d->pipeWriter;
       
   433         d->pipeWriter = 0;
       
   434     }
       
   435 
   428     flush();
   436     flush();
   429     if (d->pipeWriter && d->pipeWriter->bytesToWrite() != 0) {
   437     if (d->pipeWriter && d->pipeWriter->bytesToWrite() != 0) {
   430         d->state = QLocalSocket::ClosingState;
   438         d->state = QLocalSocket::ClosingState;
   431         emit stateChanged(d->state);
   439         emit stateChanged(d->state);
   432     } else {
   440     } else {