From 617a4e953bccb0e922121a82d7600963d3ff3304 Mon Sep 17 00:00:00 2001 From: lotodore Date: Wed, 2 May 2012 08:41:07 +0000 Subject: [PATCH] Trying to fix build problems with gcc 4.7 on Linux (#132). --- src/third_party/qtsingleapplication/qtlocalpeer.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/third_party/qtsingleapplication/qtlocalpeer.cpp b/src/third_party/qtsingleapplication/qtlocalpeer.cpp index 1d494a73..57ac9699 100644 --- a/src/third_party/qtsingleapplication/qtlocalpeer.cpp +++ b/src/third_party/qtsingleapplication/qtlocalpeer.cpp @@ -57,6 +57,7 @@ static PProcessIdToSessionId pProcessIdToSessionId = 0; #endif #if defined(Q_OS_UNIX) #include +#include #endif namespace QtLP_Private { @@ -164,8 +165,12 @@ bool QtLocalPeer::sendMessage(const QString &message, int timeout) QDataStream ds(&socket); ds.writeBytes(uMsg.constData(), uMsg.size()); bool res = socket.waitForBytesWritten(timeout); - res &= socket.waitForReadyRead(timeout); // wait for ack - res &= (socket.read(qstrlen(ack)) == ack); + if (res) { + res &= socket.waitForReadyRead(timeout); // wait for ack + if (res) { + res &= (socket.read(qstrlen(ack)) == ack); + } + } return res; }