From 558089fb21e7f388f9810c51abbd9bf3872b2178 Mon Sep 17 00:00:00 2001 From: Kurt Korbatits Date: Thu, 10 Jun 2010 13:46:34 +1000 Subject: QMovie cpu usage up to 100% Changed gif default frame rate from 0 to 100ms. This is the same as what web browsers seem to be using. Task-number:QTBUG-2441 Reviewed-by:Dmytro Poplavskiy --- src/plugins/imageformats/gif/qgifhandler.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/imageformats/gif/qgifhandler.cpp b/src/plugins/imageformats/gif/qgifhandler.cpp index 25d3dfa..56dac52 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; -- cgit v0.12 From a4df1784086ee086e64b35fc1d2df827704708be Mon Sep 17 00:00:00 2001 From: Kurt Korbatits Date: Thu, 10 Jun 2010 14:36:54 +1000 Subject: Regression Qt4.4: QMovie does not render properly some mng files Task-number:QTBUG-2414 Reviewed-by:Dmytro Poplavskiy --- src/plugins/imageformats/mng/qmnghandler.cpp | 1 - 1 file changed, 1 deletion(-) 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; -- cgit v0.12 From 78e74249014b152b93dae07bf194b16769016ad0 Mon Sep 17 00:00:00 2001 From: David Fries Date: Mon, 14 Jun 2010 13:57:46 +0200 Subject: fix detection of header files Disable the include generation iff a dot which is not followed by [hH] is found after the last path separator. This implies that dots in directory names are now ignored, and that files without an extension are always considered headers (e.g., STL headers and Qt forwarding headers). Task-number: QTBUG-11369 Merge-request: 686 Reviewed-by: Oswald Buddenhagen --- src/tools/moc/main.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) 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()) { -- cgit v0.12 From fd96a8180a5ccfeaea5b081c42137d18d640c25e Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 14 Jun 2010 19:15:21 +0200 Subject: QLocalSocket/Win: call close on async connection loss If we notice a broken pipe via _q_notified, we should call close in case the internal read buffer is empty. Auto test added: tst_QLocalSocket::asyncDisconnectNotify Reviewed-by: ossi --- src/network/socket/qlocalsocket_win.cpp | 2 ++ tests/auto/qlocalsocket/tst_qlocalsocket.cpp | 21 ++++++++++++++++++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/network/socket/qlocalsocket_win.cpp b/src/network/socket/qlocalsocket_win.cpp index 2223ebe..01cbd4b 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(); diff --git a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp index d2cba6e..1acd669 100644 --- a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp @@ -115,7 +115,7 @@ private slots: void writeToClientAndDisconnect(); void debug(); void bytesWrittenSignal(); - + void asyncDisconnectNotify(); #ifdef Q_OS_SYMBIAN private: @@ -1061,6 +1061,25 @@ void tst_QLocalSocket::bytesWrittenSignal() QVERIFY(writeThread.wait(2000)); } + +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) { -- cgit v0.12 From 1d307402d03dea32b6e95a1eec6a79448fbe892a Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 14 Jun 2010 19:16:13 +0200 Subject: QLocalSocket/Win: check for broken pipe in waitForReadyRead In waitForReadyRead we didn't check for synchronous connection loss. Autotest added: tst_QLocalSocket::syncDisconnectNotify Reviewed-by: ossi --- src/network/socket/qlocalsocket_win.cpp | 11 +++++++++++ tests/auto/qlocalsocket/tst_qlocalsocket.cpp | 17 +++++++++++++++++ 2 files changed, 28 insertions(+) diff --git a/src/network/socket/qlocalsocket_win.cpp b/src/network/socket/qlocalsocket_win.cpp index 01cbd4b..5486f47 100644 --- a/src/network/socket/qlocalsocket_win.cpp +++ b/src/network/socket/qlocalsocket_win.cpp @@ -570,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/tests/auto/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp index 1acd669..4cbb156 100644 --- a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp @@ -115,6 +115,7 @@ private slots: void writeToClientAndDisconnect(); void debug(); void bytesWrittenSignal(); + void syncDisconnectNotify(); void asyncDisconnectNotify(); #ifdef Q_OS_SYMBIAN @@ -1061,6 +1062,22 @@ 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() { -- cgit v0.12 From d61a1fecde3d4a5b34a849ae852a498e6bb1c2de Mon Sep 17 00:00:00 2001 From: Joerg Bornemann Date: Mon, 14 Jun 2010 19:17:55 +0200 Subject: beautify tst_QLocalSocket::writeToClientAndDisconnect Reviewed-by: ossi --- tests/auto/qlocalsocket/tst_qlocalsocket.cpp | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp index 4cbb156..9c09917 100644 --- a/tests/auto/qlocalsocket/tst_qlocalsocket.cpp +++ b/tests/auto/qlocalsocket/tst_qlocalsocket.cpp @@ -997,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); } -- cgit v0.12 From aa97c7b7a71ddaf3f01f312658b9a43428846aee Mon Sep 17 00:00:00 2001 From: Kurt Korbatits Date: Tue, 15 Jun 2010 10:00:46 +1000 Subject: Fixed unit test failure in qimagereader. This bug was introduced with bug fix 558089fb21e7f388f9810c51abbd9bf3872b2178 --- src/plugins/imageformats/gif/qgifhandler.cpp | 2 +- tests/auto/qimagereader/tst_qimagereader.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/plugins/imageformats/gif/qgifhandler.cpp b/src/plugins/imageformats/gif/qgifhandler.cpp index 56dac52..cba3ff6 100644 --- a/src/plugins/imageformats/gif/qgifhandler.cpp +++ b/src/plugins/imageformats/gif/qgifhandler.cpp @@ -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/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp index 99244c2..fc2582f 100644 --- a/tests/auto/qimagereader/tst_qimagereader.cpp +++ b/tests/auto/qimagereader/tst_qimagereader.cpp @@ -1763,14 +1763,14 @@ void tst_QImageReader::testIgnoresFormatAndExtension() QFETCH(QString, expected); QList 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; -- cgit v0.12