From 0389da311c2fac00b89bb7241345eec2bb42b615 Mon Sep 17 00:00:00 2001 From: David Rosca Date: Wed, 23 Jan 2019 17:05:55 +0100 Subject: [PATCH] Fix leaking QWebEngineUrlRequestJob reply BUG: 403129 FIXED-IN: 3.1.0 --- src/lib/network/schemehandlers/extensionschemehandler.cpp | 2 +- src/lib/network/schemehandlers/falkonschemehandler.cpp | 2 +- src/plugins/KDEFrameworksIntegration/kioschemehandler.cpp | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/lib/network/schemehandlers/extensionschemehandler.cpp b/src/lib/network/schemehandlers/extensionschemehandler.cpp index 26120ab9b..39d259468 100644 --- a/src/lib/network/schemehandlers/extensionschemehandler.cpp +++ b/src/lib/network/schemehandlers/extensionschemehandler.cpp @@ -24,7 +24,7 @@ // ExtensionSchemeHandler void ExtensionSchemeHandler::setReply(QWebEngineUrlRequestJob *job, const QByteArray &contentType, const QByteArray &content) { - QBuffer *buffer = new QBuffer(); + QBuffer *buffer = new QBuffer(job); buffer->open(QIODevice::ReadWrite); buffer->write(content); buffer->seek(0); diff --git a/src/lib/network/schemehandlers/falkonschemehandler.cpp b/src/lib/network/schemehandlers/falkonschemehandler.cpp index d14ba8c29..ed47c6966 100644 --- a/src/lib/network/schemehandlers/falkonschemehandler.cpp +++ b/src/lib/network/schemehandlers/falkonschemehandler.cpp @@ -55,7 +55,7 @@ void FalkonSchemeHandler::requestStarted(QWebEngineUrlRequestJob *job) knownPages << "about" << "start" << "speeddial" << "config" << "restore"; if (knownPages.contains(job->requestUrl().path())) - job->reply(QByteArrayLiteral("text/html"), new FalkonSchemeReply(job)); + job->reply(QByteArrayLiteral("text/html"), new FalkonSchemeReply(job, job)); else job->fail(QWebEngineUrlRequestJob::UrlInvalid); } diff --git a/src/plugins/KDEFrameworksIntegration/kioschemehandler.cpp b/src/plugins/KDEFrameworksIntegration/kioschemehandler.cpp index ce35f9ffb..1a32196ac 100644 --- a/src/plugins/KDEFrameworksIntegration/kioschemehandler.cpp +++ b/src/plugins/KDEFrameworksIntegration/kioschemehandler.cpp @@ -57,6 +57,7 @@ void KIOSchemeHandler::requestStarted(QWebEngineUrlRequestJob *job) qWarning() << "Error:" << reply->errorString(); job->fail(QWebEngineUrlRequestJob::RequestFailed); } else { + reply->setParent(job); job->reply(reply->header(QNetworkRequest::ContentTypeHeader).toByteArray(), reply); } });