Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 91a4ab57 authored by Andras Mantia's avatar Andras Mantia

Don't crash with Qt 5.11+

Summary:
Based on the patch from https://bugs.kde.org/show_bug.cgi?id=371511
See also https://bugreports.qt.io/browse/QTBUG-72260

BUG: 371511

Reviewers: PHID-PROJ-odxxyyfgujhgbu6ergrt, mlaurent

Reviewed By: PHID-PROJ-odxxyyfgujhgbu6ergrt, mlaurent

Subscribers: marten, asturmlechner, kfunk, kde-pim

Tags: #kde_pim

Differential Revision: https://phabricator.kde.org/D17563
parent 5a49dce5
......@@ -46,6 +46,7 @@
#include <QMenu>
#include <viewerplugintoolmanager.h>
#include <QWebEngineProfile>
#include <QWebEngineUrlRequestInterceptor>
#include <WebEngineViewer/WebHitTestResult>
#include <WebEngineViewer/WebHitTest>
......@@ -57,6 +58,19 @@
using namespace Akregator;
class AkregatorRequestInterceptor : public QWebEngineUrlRequestInterceptor
{
Q_OBJECT
public:
explicit AkregatorRequestInterceptor(QObject *parent = nullptr) : QWebEngineUrlRequestInterceptor(parent) {
}
void interceptRequest(QWebEngineUrlRequestInfo &info) override {
Q_UNUSED(info);
}
};
ArticleViewerWebEngine::ArticleViewerWebEngine(KActionCollection *ac, QWidget *parent)
: WebEngineViewer::WebEngineView(parent)
, mActionCollection(ac)
......@@ -64,10 +78,16 @@ ArticleViewerWebEngine::ArticleViewerWebEngine(KActionCollection *ac, QWidget *p
, mViewerPluginToolManager(nullptr)
{
mNetworkAccessManager = new WebEngineViewer::InterceptorManager(this, ac, this);
QWebEngineProfile *profile = QWebEngineProfile::defaultProfile();
mPageEngine = new ArticleViewerWebEnginePage(profile, this);
profile->setPersistentCookiesPolicy(QWebEngineProfile::ForcePersistentCookies);
// Needed to workaround crash in webengine, see https://bugreports.qt.io/browse/QTBUG-72260
auto webEngineUrlInterceptor = new AkregatorRequestInterceptor();
profile->setRequestInterceptor(webEngineUrlInterceptor);
connect(profile, &QObject::destroyed, webEngineUrlInterceptor, &AkregatorRequestInterceptor::deleteLater);
setPage(mPageEngine);
connect(this, &ArticleViewerWebEngine::showContextMenu, this, &ArticleViewerWebEngine::slotShowContextMenu);
......@@ -494,3 +514,5 @@ void ArticleViewerWebEngine::slotActivatePlugin(MessageViewer::ViewerPluginInter
interface->setUrl(mCurrentUrl);
interface->execute();
}
#include "articleviewerwebengine.moc"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment