X-Git-Url: https://jxself.org/git/?a=blobdiff_plain;f=config%2Fmenu.c;h=fd3f0180e08fbafb537e128c9e46641288c68774;hb=6cbac37e1eefd4d5f75879136cff03cdfd6c2e01;hp=b5c7d90df9df801dac0ca12d64b609e686e74b62;hpb=e5ef38a8fa9ef524c3ef061083ce35d1529e5ea0;p=carl9170fw.git diff --git a/config/menu.c b/config/menu.c index b5c7d90..fd3f018 100644 --- a/config/menu.c +++ b/config/menu.c @@ -146,11 +146,24 @@ struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *e struct menu *menu = current_entry; while ((menu = menu->parent) != NULL) { + struct expr *dup_expr; + if (!menu->visibility) continue; + /* + * Do not add a reference to the + * menu's visibility expression but + * use a copy of it. Otherwise the + * expression reduction functions + * will modify expressions that have + * multiple references which can + * cause unwanted side effects. + */ + dup_expr = expr_copy(menu->visibility); + prop->visible.expr = expr_alloc_and(prop->visible.expr, - menu->visibility); + dup_expr); } }