logo

badwolf

minimalist and privacy-oriented web browser based on WebKitGTK git clone https://hacktivis.me/git/badwolf.git
commit: b7891e286e9585e6d3cd97a22446e32f461ad374
parent 27879ada4b187905c713587baa6681bd8acb20e1
Author: Haelwenn (lanodan) Monnier <contact@hacktivis.me>
Date:   Tue, 22 Aug 2023 17:35:28 +0200

Do not set web-context when old_browser is present

This fixes a crash in WebKitGTK 2.41.91

Diffstat:

Mbadwolf.c25+++++++++++--------------
1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/badwolf.c b/badwolf.c @@ -654,7 +654,7 @@ new_browser(struct Window *window, const gchar *target_url, struct Client *old_b target_url = badwolf_ensure_uri_scheme(target_url, (old_browser == NULL)); char *badwolf_l10n = NULL; - WebKitWebContext *web_context; + WebKitWebContext *web_context = NULL; if(browser == NULL) return NULL; @@ -713,22 +713,18 @@ new_browser(struct Window *window, const gchar *target_url, struct Client *old_b "download-started", G_CALLBACK(web_contextCb_download_started), browser); - } - else - { - web_context = webkit_web_view_get_context(old_browser->webView); - } - /* flawfinder: ignore. Consider that g_strsplit is safe enough */ - badwolf_l10n = getenv("BADWOLF_L10N"); + /* flawfinder: ignore. Consider that g_strsplit is safe enough */ + badwolf_l10n = getenv("BADWOLF_L10N"); - if(badwolf_l10n != NULL) - { - gchar **languages = g_strsplit(badwolf_l10n, ":", -1); - webkit_web_context_set_spell_checking_languages(web_context, (const gchar *const *)languages); - g_strfreev(languages); + if(badwolf_l10n != NULL) + { + gchar **languages = g_strsplit(badwolf_l10n, ":", -1); + webkit_web_context_set_spell_checking_languages(web_context, (const gchar *const *)languages); + g_strfreev(languages); - webkit_web_context_set_spell_checking_enabled(web_context, TRUE); + webkit_web_context_set_spell_checking_enabled(web_context, TRUE); + } } WebKitSettings *settings = webkit_settings_new_with_settings(BADWOLF_WEBKIT_SETTINGS); @@ -748,6 +744,7 @@ new_browser(struct Window *window, const gchar *target_url, struct Client *old_b "user-content-manager", window->content_manager, NULL)); + gtk_widget_set_name(GTK_WIDGET(browser->webView), "browser__webView"); if(old_browser == NULL) {