diff options
author | Aqua-sama <aqua@iserlohn-fortress.net> | 2020-05-28 22:05:45 +0300 |
---|---|---|
committer | Aqua-sama <aqua@iserlohn-fortress.net> | 2020-05-29 14:33:05 +0300 |
commit | 149043a24273e5f02ed921e33c256567156fa95a (patch) | |
tree | 9cf19007a2dd055e75fb8d9d2335737ae90fb333 /src/webengine/webview.cpp | |
parent | Turn on more warnings by default (diff) | |
download | smolbote-149043a24273e5f02ed921e33c256567156fa95a.tar.xz |
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
Diffstat (limited to 'src/webengine/webview.cpp')
-rw-r--r-- | src/webengine/webview.cpp | 14 |
1 files changed, 4 insertions, 10 deletions
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); } |