diff --git a/messageviewer/src/viewer/webengine/mailwebengineview.cpp b/messageviewer/src/viewer/webengine/mailwebengineview.cpp --- a/messageviewer/src/viewer/webengine/mailwebengineview.cpp +++ b/messageviewer/src/viewer/webengine/mailwebengineview.cpp @@ -119,6 +119,16 @@ MailWebEngineView::~MailWebEngineView() { + // The MailWebEnginePage must be deleted before its QWebEngineProfile + // (created as a child of ourselves in the constructor above) is deleted, + // otherwise there will be a crash in QWebEnginePagePrivate::bindPageAndWidget(). + // See https://phabricator.kde.org/D19559 for more information. + // + // From the QWebEnginePage API documentation: "If the profile is not the + // default profile, the caller must ensure that the profile stays alive for + // as long as the page does". + delete d->mPageEngine; + delete d; }