From b3cbad9c47b52e2b8073b0dab680f89110520cac Mon Sep 17 00:00:00 2001 From: anatoly-os Date: Wed, 27 Feb 2019 17:34:45 +0200 Subject: [PATCH] Merge pull request #4733 from anatoly-os/saveonline_fix_clear_cache fix #284874: login screen in Save online is empty --- mscore/network/loginmanager.cpp | 8 ++++++++ mscore/startcenter.cpp | 17 ++++++++++++++--- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/mscore/network/loginmanager.cpp b/mscore/network/loginmanager.cpp index e6471e83c84f2..8a676359e0108 100644 --- a/mscore/network/loginmanager.cpp +++ b/mscore/network/loginmanager.cpp @@ -313,6 +313,14 @@ void LoginManager::loginInteractive() profile->setPersistentCookiesPolicy(QWebEngineProfile::NoPersistentCookies); profile->setRequestInterceptor(new ApiWebEngineRequestInterceptor(profile)); + //workaround for the crashes sometimes happend in Chromium on macOS with Qt 5.12 + connect(webView, &QWebEngineView::renderProcessTerminated, this, [profile, webView](QWebEnginePage::RenderProcessTerminationStatus terminationStatus, int exitCode) + { + qDebug() << "Login page loading terminated" << terminationStatus << " " << exitCode; + profile->clearHttpCache(); + webView->show(); + }); + connect(page, &QWebEnginePage::loadFinished, this, [this, page, webView](bool ok) { if (!ok) return; diff --git a/mscore/startcenter.cpp b/mscore/startcenter.cpp index df13c02f70032..eab1c8f271e95 100644 --- a/mscore/startcenter.cpp +++ b/mscore/startcenter.cpp @@ -61,17 +61,28 @@ Startcenter::Startcenter(QWidget* parent) #ifdef USE_WEBENGINE if (!noWebView) { _webView = new MyWebView(this); - _webView->setMaximumWidth(200); + _webView->setMaximumWidth(200); MyWebEnginePage* page = new MyWebEnginePage(this); MyWebUrlRequestInterceptor* wuri = new MyWebUrlRequestInterceptor(page); - page->profile()->setRequestInterceptor(wuri); + QWebEngineProfile* profile = page->profile(); + profile->setRequestInterceptor(wuri); _webView->setPage(page); auto extendedVer = QString(VERSION) + "." + QString(BUILD_NUMBER); - _webView->setUrl(QUrl(QString("https://connect2.musescore.com/?version=%1").arg(extendedVer))); + QUrl connectPageUrl = QUrl(QString("https://connect2.musescore.com/?version=%1").arg(extendedVer)); + _webView->setUrl(connectPageUrl); horizontalLayout->addWidget(_webView); + + //workaround for the crashes sometimes happend in Chromium on macOS with Qt 5.12 + connect(_webView, &QWebEngineView::renderProcessTerminated, this, [this, profile, &connectPageUrl](QWebEnginePage::RenderProcessTerminationStatus terminationStatus, int exitCode) + { + qDebug() << "Login page loading terminated" << terminationStatus << " " << exitCode; + profile->clearHttpCache(); + _webView->load(connectPageUrl); + _webView->show(); + }); } #endif