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.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.cpp')
-rw-r--r-- | src/network/socket/qlocalsocket.cpp | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/src/network/socket/qlocalsocket.cpp b/src/network/socket/qlocalsocket.cpp index 1ce6568364..f516b932e7 100644 --- a/src/network/socket/qlocalsocket.cpp +++ b/src/network/socket/qlocalsocket.cpp @@ -71,6 +71,22 @@ QT_BEGIN_NAMESPACE */ /*! + \fn void QLocalSocket::connectToServer(OpenMode openMode) + \since 5.1 + + Attempts to make a connection to serverName(). + setServerName() must be called before you open the connection. + Alternatively you can use connectToServer(const QString &name, OpenMode openMode); + + The socket is opened in the given \a openMode and first enters ConnectingState. + If a connection is established, QLocalSocket enters ConnectedState and emits connected(). + + After calling this function, the socket can emit error() to signal that an error occurred. + + \sa state(), serverName(), waitForConnected() +*/ + +/*! \fn void QLocalSocket::open(OpenMode openMode) Equivalent to connectToServer(OpenMode mode). @@ -352,23 +368,10 @@ QLocalSocket::~QLocalSocket() #endif } -/*! - \since 5.1 - - Attempts to make a connection to serverName(). - setServerName() must be called before you open the connection. - Alternatively you can use connectToServer(const QString &name, OpenMode openMode); - - The socket is opened in the given \a openMode and first enters ConnectingState. - If a connection is established, QLocalSocket enters ConnectedState and emits connected(). - - After calling this function, the socket can emit error() to signal that an error occurred. - - \sa state(), serverName(), waitForConnected() -*/ -void QLocalSocket::connectToServer(OpenMode openMode) +bool QLocalSocket::open(OpenMode openMode) { - open(openMode); + connectToServer(openMode); + return isOpen(); } /*! \overload @@ -385,7 +388,7 @@ void QLocalSocket::connectToServer(OpenMode openMode) void QLocalSocket::connectToServer(const QString &name, OpenMode openMode) { setServerName(name); - open(openMode); + connectToServer(openMode); } /*! |