diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2013-07-07 10:12:24 -0700 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-07-20 00:22:03 +0200 |
commit | 674e79416fefe7b5acf2a8c18d3c91d8feddcc18 (patch) | |
tree | 97d70c8e9be1249cffa6b36abd0bcfcbcfc69e73 /src/network/socket/qlocalsocket_tcp.cpp | |
parent | 4a7e37b0a3741f11dad3cca435badaaf42e59741 (diff) |
Fix incomplete override of QIODevice::open in QProcess and QLocalSocket
The rule for a new override is that it must still work if the old
implementation is called. The catch is that any class that derives from
QProcess and isn't recompiled will still have QIODevice::open in its
virtual table. That is equivalent to overriding open() and calling
QIODevice::open() (like the tests).
In Qt 5.0, QProcess::start() called QIODevice::open directly, not the
virtual open(), so there's no expectation that a user-overridden open()
be called. With that in mind, simply fix QProcess::start to not call the
virtual open at all.
Similarly with QLocalSocket, the calls to open were always non-virtual.
Task-number: QTBUG-32284
Change-Id: I88925f0ba08bc23c849658b54582744997e69a4c
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
Diffstat (limited to 'src/network/socket/qlocalsocket_tcp.cpp')
-rw-r--r-- | src/network/socket/qlocalsocket_tcp.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/network/socket/qlocalsocket_tcp.cpp b/src/network/socket/qlocalsocket_tcp.cpp index 31aaa6e1c5..1a61a54a76 100644 --- a/src/network/socket/qlocalsocket_tcp.cpp +++ b/src/network/socket/qlocalsocket_tcp.cpp @@ -214,13 +214,13 @@ void QLocalSocketPrivate::errorOccurred(QLocalSocket::LocalSocketError error, co q->emit stateChanged(state); } -bool QLocalSocket::open(OpenMode openMode) +void QLocalSocket::connectToServer(OpenMode openMode) { Q_D(QLocalSocket); if (state() == ConnectedState || state() == ConnectingState) { setErrorString(tr("Trying to connect while connection is in progress")); emit error(QLocalSocket::OperationError); - return false; + return; } d->errorString.clear(); @@ -230,7 +230,7 @@ bool QLocalSocket::open(OpenMode openMode) if (d->serverName.isEmpty()) { d->errorOccurred(ServerNotFoundError, QLatin1String("QLocalSocket::connectToServer")); - return false; + return; } const QLatin1String prefix("QLocalServer/"); @@ -245,11 +245,10 @@ bool QLocalSocket::open(OpenMode openMode) if (!ok) { d->errorOccurred(ServerNotFoundError, QLatin1String("QLocalSocket::connectToServer")); - return false; + return; } d->tcpSocket->connectToHost(QHostAddress::LocalHost, port, openMode); QIODevice::open(openMode); - return true; } bool QLocalSocket::setSocketDescriptor(qintptr socketDescriptor, |