summaryrefslogtreecommitdiffstats
path: root/examples
diff options
context:
space:
mode:
authorJoerg Bornemann <joerg.bornemann@theqtcompany.com>2016-02-10 15:20:54 +0100
committerJoerg Bornemann <joerg.bornemann@theqtcompany.com>2016-02-16 11:15:10 +0000
commitc092314bf0a4f4ab84040138366848d78a0686ad (patch)
tree2b21e3543d68a01c10baaede6c41a2d231d6880f /examples
parent5e0ebee08d43e4dd3db5127e4c39fac641d7466e (diff)
Fix removal of left-over local socket in demobrowser
Use QLocalServer::removeServer instead of QFile::remove. The socket is usually not in the current directory. Change-Id: Ie5b20b8b02ec7f3065596ebd945a6639bb65a2c0 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Diffstat (limited to 'examples')
-rw-r--r--examples/webenginewidgets/demobrowser/browserapplication.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/examples/webenginewidgets/demobrowser/browserapplication.cpp b/examples/webenginewidgets/demobrowser/browserapplication.cpp
index 33906196..37bc05c3 100644
--- a/examples/webenginewidgets/demobrowser/browserapplication.cpp
+++ b/examples/webenginewidgets/demobrowser/browserapplication.cpp
@@ -146,12 +146,11 @@ BrowserApplication::BrowserApplication(int &argc, char **argv)
m_localServer = new QLocalServer(this);
connect(m_localServer, SIGNAL(newConnection()),
this, SLOT(newLocalSocketConnection()));
- if (!m_localServer->listen(serverName)) {
- if (m_localServer->serverError() == QAbstractSocket::AddressInUseError
- && QFile::exists(m_localServer->serverName())) {
- QFile::remove(m_localServer->serverName());
- m_localServer->listen(serverName);
- }
+ if (!m_localServer->listen(serverName)
+ && m_localServer->serverError() == QAbstractSocket::AddressInUseError) {
+ QLocalServer::removeServer(serverName);
+ if (!m_localServer->listen(serverName))
+ qWarning("Could not create local socket %s.", qPrintable(serverName));
}
#ifndef QT_NO_OPENSSL