commit 30a1c0875f4ac72c1609c7beb0497d20ef789f64
parent 878b6d7a2037c66041f02f641270a02e1db7d1d3
Author: wwp <wwp@free.fr>
Date: Tue, 27 Dec 2016 18:02:55 +0100
Fix enum boundaries we check in func_selection_changed (when
changing the internal function assigned to a toolbar item).
Just a theoretical issue here apparently, or we would have had
problems since ages.
Diffstat:
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/src/prefs_toolbar.c b/src/prefs_toolbar.c
@@ -861,15 +861,18 @@ static void func_selection_changed(GtkComboBox *action_combo,
prefs_toolbar->item_func_combo));
if(text != NULL) { /* action */
- int action = -1;
+ int action;
+
action = toolbar_ret_val_from_descr(text);
- if (action >= 0)
+ g_free(text);
+ if (action > -1) {
+ gint icon;
+
gtk_entry_set_text(GTK_ENTRY(prefs_toolbar->item_text_entry),
toolbar_get_short_text(action));
- g_free(text);
- if (action >= 0) {
- StockPixmap stockp = toolbar_get_icon(action);
- if (stockp >= 0) {
+ icon = toolbar_get_icon(action);
+ if (icon > -1) {
+ StockPixmap stockp = (StockPixmap)icon;
g_free(prefs_toolbar->item_icon_file);
prefs_toolbar->item_icon_file = g_strdup(stock_pixmap_get_name(stockp));