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/webprofilemanager.h | |
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/webprofilemanager.h')
-rw-r--r-- | src/webengine/webprofilemanager.h | 13 |
1 files changed, 7 insertions, 6 deletions
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; }; |