QNetworkDiskCache - fix leak of file descriptor
When the caches is deleted, the open files are deleted without closing action. The file descriptor is remaining until the process is terminated. Change-Id: If85519d173d05548ddf3273c85800441887199e2 Reviewed-by: jungo kim <jungo.kim@lge.com> Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
This commit is contained in:
parent
c58c98a248
commit
69bf59ecfd
@ -559,6 +559,20 @@ qint64 QNetworkDiskCache::expire()
|
||||
break;
|
||||
QString name = i.value();
|
||||
QFile file(name);
|
||||
|
||||
if (name.contains(PREPARED_SLASH)) {
|
||||
QHashIterator<QIODevice*, QCacheItem*> iterator(d->inserting);
|
||||
while (iterator.hasNext()) {
|
||||
iterator.next();
|
||||
QCacheItem *item = iterator.value();
|
||||
if (item && item->file && item->file->fileName() == name) {
|
||||
delete item->file;
|
||||
item->file = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
qint64 size = file.size();
|
||||
file.remove();
|
||||
totalSize -= size;
|
||||
|
Loading…
Reference in New Issue
Block a user