summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/network/socket/qlocalsocket_win.cpp13
-rw-r--r--src/plugins/imageformats/gif/qgifhandler.cpp4
-rw-r--r--src/plugins/imageformats/mng/qmnghandler.cpp1
-rw-r--r--src/tools/moc/main.cpp7
-rw-r--r--tests/auto/qimagereader/tst_qimagereader.cpp4
-rw-r--r--tests/auto/qlocalsocket/tst_qlocalsocket.cpp49
6 files changed, 59 insertions, 19 deletions
diff --git a/src/network/socket/qlocalsocket_win.cpp b/src/network/socket/qlocalsocket_win.cpp
index 2223ebe..5486f47 100644
--- a/src/network/socket/qlocalsocket_win.cpp
+++ b/src/network/socket/qlocalsocket_win.cpp
@@ -485,6 +485,8 @@ void QLocalSocketPrivate::_q_notified()
if (!completeAsyncRead()) {
pipeClosed = true;
emit q->readChannelFinished();
+ if (actualReadBufferSize == 0)
+ QTimer::singleShot(0, q, SLOT(_q_pipeClosed()));
return;
}
startAsyncRead();
@@ -568,11 +570,22 @@ bool QLocalSocket::waitForReadyRead(int msecs)
if (d->state != QLocalSocket::ConnectedState)
return false;
+ // We already know that the pipe is gone, but did not enter the event loop yet.
+ if (d->pipeClosed) {
+ close();
+ return false;
+ }
+
Q_ASSERT(d->readSequenceStarted);
DWORD result = WaitForSingleObject(d->overlapped.hEvent, msecs == -1 ? INFINITE : msecs);
switch (result) {
case WAIT_OBJECT_0:
d->_q_notified();
+ // We just noticed that the pipe is gone.
+ if (d->pipeClosed) {
+ close();
+ return false;
+ }
return true;
case WAIT_TIMEOUT:
return false;
diff --git a/src/plugins/imageformats/gif/qgifhandler.cpp b/src/plugins/imageformats/gif/qgifhandler.cpp
index 8abc2d1..2da822d 100644
--- a/src/plugins/imageformats/gif/qgifhandler.cpp
+++ b/src/plugins/imageformats/gif/qgifhandler.cpp
@@ -1026,7 +1026,7 @@ inline QRgb QGIFFormat::color(uchar index) const
QGifHandler::QGifHandler()
{
gifFormat = new QGIFFormat;
- nextDelay = 0;
+ nextDelay = 100;
loopCnt = 1;
frameNumber = -1;
scanIsCached = false;
@@ -1061,7 +1061,7 @@ bool QGifHandler::imageIsComing() const
bool QGifHandler::canRead() const
{
- if (!nextDelay && canRead(device())) {
+ if (canRead(device())) {
setFormat("gif");
return true;
}
diff --git a/src/plugins/imageformats/mng/qmnghandler.cpp b/src/plugins/imageformats/mng/qmnghandler.cpp
index d408e6c..9dbb885 100644
--- a/src/plugins/imageformats/mng/qmnghandler.cpp
+++ b/src/plugins/imageformats/mng/qmnghandler.cpp
@@ -271,7 +271,6 @@ bool QMngHandlerPrivate::getNextImage(QImage *result)
}
if ((MNG_NOERROR == ret) || (MNG_NEEDTIMERWAIT == ret)) {
*result = image;
- image.fill(0);
frameIndex = nextIndex++;
if (haveReadAll && (frameCount == 0))
frameCount = nextIndex;
diff --git a/src/tools/moc/main.cpp b/src/tools/moc/main.cpp
index ebe1834..4997690 100644
--- a/src/tools/moc/main.cpp
+++ b/src/tools/moc/main.cpp
@@ -359,11 +359,10 @@ int runMoc(int _argc, char **_argv)
if (autoInclude) {
+ int spos = filename.lastIndexOf(QDir::separator().toLatin1());
int ppos = filename.lastIndexOf('.');
- moc.noInclude = (ppos >= 0
- && tolower(filename[ppos + 1]) != 'h'
- && tolower(filename[ppos + 1]) != QDir::separator().toLatin1()
- );
+ // spos >= -1 && ppos > spos => ppos >= 0
+ moc.noInclude = (ppos > spos && tolower(filename[ppos + 1]) != 'h');
}
if (moc.includeFiles.isEmpty()) {
if (moc.includePath.isEmpty()) {
diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp
index aadee5b..1fe1332 100644
--- a/tests/auto/qimagereader/tst_qimagereader.cpp
+++ b/tests/auto/qimagereader/tst_qimagereader.cpp
@@ -1884,14 +1884,14 @@ void tst_QImageReader::testIgnoresFormatAndExtension()
QFETCH(QString, expected);
QList<QByteArray> formats = QImageReader::supportedImageFormats();
- QString fileNameBase = "images/" + name + ".";
+ QString fileNameBase = prefix + name + ".";
foreach (const QByteArray &f, formats) {
if (f == extension)
continue;
QFile tmp(QDir::tempPath() + "/" + name + "_" + expected + "." + f);
- QFile::copy(fileNameBase + extension, QFileInfo(tmp).absoluteFilePath());
+ QVERIFY(QFile::copy(fileNameBase + extension, QFileInfo(tmp).absoluteFilePath()));
QString format;
QImage image;
diff --git a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp
index d2cba6e..9c09917 100644
--- a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp
+++ b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp
@@ -115,7 +115,8 @@ private slots:
void writeToClientAndDisconnect();
void debug();
void bytesWrittenSignal();
-
+ void syncDisconnectNotify();
+ void asyncDisconnectNotify();
#ifdef Q_OS_SYMBIAN
private:
@@ -996,16 +997,9 @@ void tst_QLocalSocket::writeToClientAndDisconnect()
clientSocket->close();
server.close();
- // Wait for the client to notice the broken connection.
- int timeout = 5000;
- do {
- const int timestep = 100;
- QTest::qWait(timestep);
- timeout -= timestep;
- } while (!readChannelFinishedSpy.count() && timeout > 0);
-
- QCOMPARE(readChannelFinishedSpy.count(), 1);
+ QTRY_COMPARE(readChannelFinishedSpy.count(), 1);
QCOMPARE(client.read(buffer, sizeof(buffer)), (qint64)sizeof(buffer));
+ client.waitForDisconnected();
QCOMPARE(client.state(), QLocalSocket::UnconnectedState);
}
@@ -1061,6 +1055,41 @@ void tst_QLocalSocket::bytesWrittenSignal()
QVERIFY(writeThread.wait(2000));
}
+void tst_QLocalSocket::syncDisconnectNotify()
+{
+#ifdef Q_OS_SYMBIAN
+ unlink("syncDisconnectNotify");
+#endif
+
+ QLocalServer server;
+ QVERIFY(server.listen("syncDisconnectNotify"));
+ QLocalSocket client;
+ client.connectToServer("syncDisconnectNotify");
+ QVERIFY(server.waitForNewConnection());
+ QLocalSocket* serverSocket = server.nextPendingConnection();
+ QVERIFY(serverSocket);
+ delete serverSocket;
+ QCOMPARE(client.waitForReadyRead(), false);
+}
+
+void tst_QLocalSocket::asyncDisconnectNotify()
+{
+#ifdef Q_OS_SYMBIAN
+ unlink("asyncDisconnectNotify");
+#endif
+
+ QLocalServer server;
+ QVERIFY(server.listen("asyncDisconnectNotify"));
+ QLocalSocket client;
+ QSignalSpy disconnectedSpy(&client, SIGNAL(disconnected()));
+ client.connectToServer("asyncDisconnectNotify");
+ QVERIFY(server.waitForNewConnection());
+ QLocalSocket* serverSocket = server.nextPendingConnection();
+ QVERIFY(serverSocket);
+ delete serverSocket;
+ QTRY_VERIFY(!disconnectedSpy.isEmpty());
+}
+
#ifdef Q_OS_SYMBIAN
void tst_QLocalSocket::unlink(QString name)
{