From a341d809b265c56342b6c516b0cc4674a7a70d08 Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Mon, 3 Jan 2011 14:41:14 +0100 Subject: Fix crash when changing or removing color palette options --- src/core/wee-config.c | 2 +- src/gui/gui-color.c | 30 +----------------------------- src/gui/gui-color.h | 1 - 3 files changed, 2 insertions(+), 31 deletions(-) diff --git a/src/core/wee-config.c b/src/core/wee-config.c index 6128b0dcb..79e9f541d 100644 --- a/src/core/wee-config.c +++ b/src/core/wee-config.c @@ -693,7 +693,7 @@ config_weechat_palette_change_cb (void *data, number = (int)strtol (option->name, &error, 10); if (error && !error[0]) { - gui_color_palette_change (number, CONFIG_STRING(option)); + gui_color_palette_add (number, CONFIG_STRING(option)); } } diff --git a/src/gui/gui-color.c b/src/gui/gui-color.c index 46d2c302b..d7e5c4ccd 100644 --- a/src/gui/gui-color.c +++ b/src/gui/gui-color.c @@ -574,7 +574,7 @@ gui_color_palette_get (int number) void gui_color_palette_add (int number, const char *value) { - struct t_gui_color_palette *new_color_palette, *ptr_color_palette; + struct t_gui_color_palette *new_color_palette; char str_number[64]; gui_color_palette_alloc_structs (); @@ -584,10 +584,6 @@ gui_color_palette_add (int number, const char *value) return; snprintf (str_number, sizeof (str_number), "%d", number); - ptr_color_palette = hashtable_get (gui_color_hash_palette_color, - str_number); - if (ptr_color_palette) - gui_color_palette_free (ptr_color_palette); hashtable_set (gui_color_hash_palette_color, str_number, new_color_palette); gui_color_palette_build_aliases (); @@ -616,7 +612,6 @@ gui_color_palette_remove (int number) str_number); if (ptr_color_palette) { - gui_color_palette_free (ptr_color_palette); hashtable_remove (gui_color_hash_palette_color, str_number); gui_color_palette_build_aliases (); if (gui_init_ok) @@ -627,29 +622,6 @@ gui_color_palette_remove (int number) } } -/* - * gui_color_palette_change: change a color in palette - */ - -void -gui_color_palette_change (int number, const char *value) -{ - struct t_gui_color_palette *ptr_color_palette; - char str_number[64]; - - gui_color_palette_alloc_structs (); - - snprintf (str_number, sizeof (str_number), "%d", number); - ptr_color_palette = hashtable_get (gui_color_hash_palette_color, - str_number); - if (ptr_color_palette) - { - gui_color_palette_free (ptr_color_palette); - hashtable_remove (gui_color_hash_palette_color, str_number); - gui_color_palette_add (number, value); - } -} - /* * gui_color_palette_free_structs: free hashtables and lists for palette */ diff --git a/src/gui/gui-color.h b/src/gui/gui-color.h index e756ac84b..de102b3e5 100644 --- a/src/gui/gui-color.h +++ b/src/gui/gui-color.h @@ -158,7 +158,6 @@ extern int gui_color_palette_get_alias (const char *alias); extern struct t_gui_color_palette *gui_color_palette_get (int number); extern void gui_color_palette_add (int number, const char *value); extern void gui_color_palette_remove (int number); -extern void gui_color_palette_change (int number, const char *value); extern void gui_color_palette_free_structs (); /* color functions (GUI dependent) */ -- cgit v1.2.3