Skip to content

Commit

Permalink
Merge pull request #4733 from anatoly-os/saveonline_fix_clear_cache
Browse files Browse the repository at this point in the history
fix #284874: login screen in Save online is empty
  • Loading branch information
anatoly-os committed Feb 28, 2019
1 parent bbe8dbf commit b3cbad9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
8 changes: 8 additions & 0 deletions mscore/network/loginmanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
17 changes: 14 additions & 3 deletions mscore/startcenter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit b3cbad9

Please sign in to comment.