From 8893a590631491766615f705057f4fd3ede5cfab Mon Sep 17 00:00:00 2001 From: Sebastien Helleu Date: Mon, 20 Dec 2010 18:22:22 +0100 Subject: Build list of color aliases at startup (fix crash when setting "++1" on option if no palette option is defined) --- src/gui/curses/gui-curses-color.c | 7 +++++++ src/gui/gui-color.h | 1 + 2 files changed, 8 insertions(+) (limited to 'src') diff --git a/src/gui/curses/gui-curses-color.c b/src/gui/curses/gui-curses-color.c index 5afc5d76b..cc08c02ac 100644 --- a/src/gui/curses/gui-curses-color.c +++ b/src/gui/curses/gui-curses-color.c @@ -448,6 +448,7 @@ gui_color_init () } gui_color_init_pairs (); gui_color_init_weechat (); + gui_color_palette_build_aliases (); } /* @@ -562,6 +563,12 @@ gui_color_palette_build_aliases () { int i; + if (!gui_color_hash_palette_alias || !gui_color_list_with_alias + || !gui_color_hash_palette_color) + { + gui_color_palette_alloc (); + } + hashtable_remove_all (gui_color_hash_palette_alias); weelist_remove_all (gui_color_list_with_alias); for (i = 0; i < GUI_CURSES_NUM_WEECHAT_COLORS; i++) diff --git a/src/gui/gui-color.h b/src/gui/gui-color.h index 853fcd79d..5d199a67f 100644 --- a/src/gui/gui-color.h +++ b/src/gui/gui-color.h @@ -153,6 +153,7 @@ extern const char *gui_color_get_custom (const char *color_name); extern char *gui_color_decode (const char *string, const char *replacement); extern char *gui_color_string_replace_colors (const char *string); extern void gui_color_free (struct t_gui_color *color); +extern void gui_color_palette_alloc (); 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); -- cgit v1.2.3