diff options
author | Michal Klocek <michal.klocek@qt.io> | 2018-07-30 12:58:24 +0200 |
---|---|---|
committer | Michal Klocek <michal.klocek@qt.io> | 2018-07-30 14:16:04 +0000 |
commit | 8d8287035ce8730065d61937bee665055348fcb2 (patch) | |
tree | 1913b43079f6c7766c66e288a63b0543cded4fd2 /src/core/api/qwebengineurlrequestjob.cpp | |
parent | c56169f7a1bcbe45f3c89a78b8a5a4606666db83 (diff) |
Fix bougs documentation for QWebEngineUrlRequestJob::reply
IODevice::close and therefore aboutToClose is called by io thread,
connecting it to deleteLater will register deferred delete
on event loop of IODevice instance, which is on ui thread.
This could be racy since deletion on ui thread can happen before job
is done.
Change-Id: I895e6a71649ba65944d069f254d119cc60aada6c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'src/core/api/qwebengineurlrequestjob.cpp')
-rw-r--r-- | src/core/api/qwebengineurlrequestjob.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/core/api/qwebengineurlrequestjob.cpp b/src/core/api/qwebengineurlrequestjob.cpp index f741b88e8..c3541598b 100644 --- a/src/core/api/qwebengineurlrequestjob.cpp +++ b/src/core/api/qwebengineurlrequestjob.cpp @@ -151,9 +151,10 @@ QUrl QWebEngineUrlRequestJob::initiator() const The device should remain available at least as long as the job exists. When calling this method with a newly constructed device, one solution is to - make the device delete itself when closed, like this: + make the device as a child of the job or delete itself when job is deleted, + like this: \code - connect(device, &QIODevice::aboutToClose, device, &QObject::deleteLater); + connect(job, &QObject::destroyed, device, &QObject::deleteLater); \endcode */ void QWebEngineUrlRequestJob::reply(const QByteArray &contentType, QIODevice *device) |