diff options
author | Frantisek Vacek <fvacek@blackberry.com> | 2014-01-31 14:25:46 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-02-04 16:17:01 +0100 |
commit | cc88e6e92c806def34bce8cdcab275934ab646bf (patch) | |
tree | 68af8b3ad32034f37c7905530970d8b6438100c3 | |
parent | cd820569dc9995ce8c19a45fd87658c046185e63 (diff) | |
download | qtbase-cc88e6e92c806def34bce8cdcab275934ab646bf.tar.gz qtbase-cc88e6e92c806def34bce8cdcab275934ab646bf.tar.bz2 qtbase-cc88e6e92c806def34bce8cdcab275934ab646bf.zip |
QDeclarativeTypeLoader doesn't close processed QNetworkReplies
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
Task-number: QTBUG-36032
Change-Id: I4002f21b4b0c7350af48b0dc6530d9606fd2794b
Reviewed-by: Richard J. Moore <rich@kde.org>
Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
-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 f7555f8fc3..2724a54309 100644 --- a/src/network/access/qnetworkreplyfileimpl.cpp +++ b/src/network/access/qnetworkreplyfileimpl.cpp @@ -161,6 +161,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(); } @@ -181,7 +183,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 |