diff options
author | Peter Hartmann <peter.hartmann@trolltech.com> | 2009-02-04 13:52:23 +0100 |
---|---|---|
committer | Peter Hartmann <peter.hartmann@trolltech.com> | 2009-02-04 14:13:09 +0100 |
commit | f5222230a4bc936564ec73971b6eeefb01025094 (patch) | |
tree | e0dbb342ae51c615271b98da5c0a3f074d14f553 | |
parent | 6f4a8be9461b0c84e98cb57b9d07d2f7b1ff44de (diff) | |
download | qt-creator-f5222230a4bc936564ec73971b6eeefb01025094.tar.gz |
Fixes: QtSingleApplication: remove socket instance before listening
RevBy: Thorbjorn
Details: calls the newly introduced QLocalServer::removeServer()
function before listening. The problem was: When the socket file was
left there after the application quit (e.g. because of not closing it or
when the app crashed), the first call to listen failed with "address
already in use" error. Before, listen() would delete that file in that
case, but that behavior changed and the "removeServer()" method
introduced instead.
-rw-r--r-- | src/shared/qtsingleapplication/qtlocalpeer.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/shared/qtsingleapplication/qtlocalpeer.cpp b/src/shared/qtsingleapplication/qtlocalpeer.cpp index 4b68c67c3d..452d43545a 100644 --- a/src/shared/qtsingleapplication/qtlocalpeer.cpp +++ b/src/shared/qtsingleapplication/qtlocalpeer.cpp @@ -94,9 +94,9 @@ bool QtLocalPeer::isClient() if (!lockFile.lock(QtLockedFile::WriteLock, false)) return true; + if (!QLocalServer::removeServer(socketName)) + qWarning("QtSingleCoreApplication: could not cleanup socket"); bool res = server->listen(socketName); - if (!res && server->serverError() == QAbstractSocket::AddressInUseError) - res = server->listen(socketName); // ### Workaround 4.4.0tp bug if (!res) qWarning("QtSingleCoreApplication: listen on local socket failed, %s", qPrintable(server->errorString())); QObject::connect(server, SIGNAL(newConnection()), SLOT(receiveConnection())); |