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/webprofilemanager.h | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'src/webengine/webprofilemanager.h') diff --git a/src/webengine/webprofilemanager.h b/src/webengine/webprofilemanager.h index 91dcaf8..a356506 100644 --- a/src/webengine/webprofilemanager.h +++ b/src/webengine/webprofilemanager.h @@ -41,10 +41,11 @@ public: } if(!profiles.contains(default_id)) { - Profile profile; - profile.settings = WebProfile::load(QString(), search, homepage, newtab); - profile.ptr = WebProfile::load(default_id, profile.settings, true); - profiles[default_id] = profile; + auto *settings = WebProfile::load(QString(), search, homepage, newtab); + profiles[default_id] = Profile{ + .settings = settings, + .ptr = WebProfile::load(default_id, settings, true), + }; } WebProfile::setDefaultProfile(profiles[default_id].ptr); } @@ -73,7 +74,7 @@ public: } if(profile != nullptr && settings != nullptr) { - profiles[id] = Profile{ profile, settings, false }; + profiles[id] = Profile{ settings, profile, false }; } } @@ -101,8 +102,8 @@ private: set_typestate(consumed) void consume() {} struct Profile { - WebProfile *ptr = nullptr; QSettings *settings = nullptr; + WebProfile *ptr = nullptr; bool selfDestruct = false; }; -- cgit v1.2.1