diff options
author | Sebastien Helleu <flashcode@flashtux.org> | 2011-01-03 14:41:14 +0100 |
---|---|---|
committer | Sebastien Helleu <flashcode@flashtux.org> | 2011-01-03 14:41:14 +0100 |
commit | a341d809b265c56342b6c516b0cc4674a7a70d08 (patch) | |
tree | 0b5def9c7f19b373630826cef409c554bf9ae6df | |
parent | b38dfac5ee715dd4b7108eb38e1b1d11b7b478a3 (diff) | |
download | weechat-a341d809b265c56342b6c516b0cc4674a7a70d08.zip |
Fix crash when changing or removing color palette options
-rw-r--r-- | src/core/wee-config.c | 2 | ||||
-rw-r--r-- | src/gui/gui-color.c | 30 | ||||
-rw-r--r-- | 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) @@ -628,29 +623,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) */ |