From: Christian Dywan Date: Thu, 27 Oct 2011 21:17:16 +0000 (+0200) Subject: Copy styles passed to midori_web_settings_add_style X-Git-Url: https://spindle.queued.net/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0e5cb28e09a22dc0ec49a4fa84060434fa4b901e;p=midori Copy styles passed to midori_web_settings_add_style Style strings are usually allocated, unlike rule_id's. --- diff --git a/midori/midori-websettings.c b/midori/midori-websettings.c index 477d5d82..1b0ca64f 100644 --- a/midori/midori-websettings.c +++ b/midori/midori-websettings.c @@ -1806,7 +1806,7 @@ midori_web_settings_process_stylesheets (MidoriWebSettings* settings) /** * midori_web_settings_add_style: - * @rule_id: a string identifier + * @rule_id: a static string identifier * @style: a CSS stylesheet * * Adds or replaces a custom stylesheet. @@ -1815,16 +1815,17 @@ midori_web_settings_process_stylesheets (MidoriWebSettings* settings) **/ void midori_web_settings_add_style (MidoriWebSettings* settings, - gchar* rule_id, - gchar* style) + const gchar* rule_id, + const gchar* style) { g_return_if_fail (MIDORI_IS_WEB_SETTINGS (settings)); g_return_if_fail (rule_id != NULL); g_return_if_fail (style != NULL); if (settings->user_stylesheets == NULL) - settings->user_stylesheets = g_hash_table_new (g_str_hash, NULL); - g_hash_table_insert (settings->user_stylesheets, rule_id, style); + settings->user_stylesheets = g_hash_table_new_full (g_str_hash, NULL, + NULL, g_free); + g_hash_table_insert (settings->user_stylesheets, (gchar*)rule_id, g_strdup (style)); midori_web_settings_process_stylesheets (settings); } diff --git a/midori/midori-websettings.h b/midori/midori-websettings.h index 80bf00b8..5e343442 100644 --- a/midori/midori-websettings.h +++ b/midori/midori-websettings.h @@ -160,8 +160,8 @@ midori_web_settings_new (void); void midori_web_settings_add_style (MidoriWebSettings* settings, - gchar* rule_id, - gchar* style); + const gchar* rule_id, + const gchar* style); void midori_web_settings_remove_style (MidoriWebSettings* settings,