downloads: Check if reply is open when doing delayed write.

This fixes a "QIODevice::read: device not open" warning when closing the window
while a download is active.
This commit is contained in:
Florian Bruhin 2014-11-11 21:40:25 +01:00
parent b502280c06
commit b70c3754e8

View File

@ -266,7 +266,8 @@ class DownloadItem(QObject):
"""Write buffered data to disk and finish the QNetworkReply."""
log.downloads.debug("Doing delayed write...")
self._do_delayed_write = False
self._fileobj.write(self._reply.readAll())
if self._reply.isOpen():
self._fileobj.write(self._reply.readAll())
self._fileobj.close()
self._reply.close()
self._reply.deleteLater()