diff options
author | Frantisek Vacek <fvacek@blackberry.com> | 2014-02-10 10:12:05 (GMT) |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-11 19:39:40 (GMT) |
commit | 763f4e54a818f31b4e89c99ec10924b2738f5de6 (patch) | |
tree | 0120b094ac984f751f35f1c94940e4a053925ce9 | |
parent | 11100f235e8121af75b15a6946d66ec9a577c779 (diff) | |
download | Qt-763f4e54a818f31b4e89c99ec10924b2738f5de6.zip Qt-763f4e54a818f31b4e89c99ec10924b2738f5de6.tar.gz Qt-763f4e54a818f31b4e89c99ec10924b2738f5de6.tar.bz2 |
QDeclarativeTypeLoader doesn't close processed QNetworkReplies
backport of Qt5 patch https://codereview.qt-project.org/#change,76825
This bug causes that Cascades QML application cannot open more than
system ulimit defined number of different asset:///*.qml files.
The realFile is ordinary closed in the ~QNetworkReplyFileImpl(),
the QDeclarativeTypeLoader::networkReplyFinished() calls
reply->deleteLater(). There are tricky situations when event-loop is
not entered and too many read already files are waiting for close.
This patch close() file when all the data is read. It can be done
this way since the QNetworkReplyFileImplnetworkreply is a sequential
device.
For more info, please, read comments on QTBUG-36032
cherry-pick from: qtbase cc88e6e92c806def34bce8cdcab275934ab646bf
Task-number: QTBUG-36032
Change-Id: I896cf9a89c541d743db1ccc11ab853219d844884
Reviewed-by: Richard J. Moore <rich@kde.org>
-rw-r--r-- | src/network/access/qnetworkreplyfileimpl.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/network/access/qnetworkreplyfileimpl.cpp b/src/network/access/qnetworkreplyfileimpl.cpp index 8a8f73c..3c9923d 100644 --- a/src/network/access/qnetworkreplyfileimpl.cpp +++ b/src/network/access/qnetworkreplyfileimpl.cpp @@ -155,6 +155,8 @@ void QNetworkReplyFileImpl::abort() qint64 QNetworkReplyFileImpl::bytesAvailable() const { Q_D(const QNetworkReplyFileImpl); + if (!d->realFile.isOpen()) + return QNetworkReply::bytesAvailable(); return QNetworkReply::bytesAvailable() + d->realFile.bytesAvailable(); } @@ -175,7 +177,11 @@ qint64 QNetworkReplyFileImpl::size() const qint64 QNetworkReplyFileImpl::readData(char *data, qint64 maxlen) { Q_D(QNetworkReplyFileImpl); + if (!d->realFile.isOpen()) + return -1; qint64 ret = d->realFile.read(data, maxlen); + if (bytesAvailable() == 0 && d->realFile.isOpen()) + d->realFile.close(); if (ret == 0 && bytesAvailable() == 0) return -1; else |