From 149043a24273e5f02ed921e33c256567156fa95a Mon Sep 17 00:00:00 2001 From: Aqua-sama Date: Thu, 28 May 2020 22:05:45 +0300 Subject: Fix segfault in release build When creating a WebView out of a Session struct, fall back to the default profile if one is not set, or a profile with that ID is not found. - Update PKGBUILD --- src/webengine/webview.cpp | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'src/webengine/webview.cpp') diff --git a/src/webengine/webview.cpp b/src/webengine/webview.cpp index 38e564a..bc52102 100644 --- a/src/webengine/webview.cpp +++ b/src/webengine/webview.cpp @@ -37,9 +37,7 @@ WebView::WebView(WebProfile *profile, cb_createWindow_t cb, QWidget *parent) : WebView(parent) { cb_createWindow = cb; - Q_CHECK_PTR(profile); - m_profile = profile; - setPage(new WebPage(profile, this)); + setProfile(profile); } WebView::WebView(const Session::WebView &webview_data, cb_createWindow_t cb, QWidget *parent) @@ -47,11 +45,7 @@ WebView::WebView(const Session::WebView &webview_data, cb_createWindow_t cb, QWi { cb_createWindow = cb; WebProfileManager profileManager; - - auto *profile = profileManager.profile(webview_data.profile); - if(profile != nullptr) { - setProfile(profile); - } + setProfile(profileManager.profile(webview_data.profile)); if(!webview_data.url.isEmpty()) load(QUrl::fromUserInput(webview_data.url)); @@ -64,9 +58,9 @@ WebView::WebView(const Session::WebView &webview_data, cb_createWindow_t cb, QWi void WebView::setProfile(WebProfile *profile) { - m_profile = profile; + m_profile = (profile == nullptr) ? WebProfile::defaultProfile() : profile; const auto url = this->url(); - setPage(new WebPage(profile, this)); + setPage(new WebPage(m_profile, this)); this->load(url); } -- cgit v1.2.1