fix double free for mode toggle if bar was invisible

If the bar was set to "invisible" and subsequently "toggle" was send twice, the
new mode was never set and the bar->mode was double freed.
Fix this by not requiring the bar->mode to be "hide" and instead show it
unconditionally, because it was either hidden or invisible.

Fixes #3637
master
Rouven Czerwinski 6 years ago committed by emersion
parent 995b6edab6
commit 605e515a93

@ -11,7 +11,7 @@ static struct cmd_results *bar_set_mode(struct bar_config *bar, const char *mode
if (strcasecmp("toggle", mode) == 0 && !config->reading) { if (strcasecmp("toggle", mode) == 0 && !config->reading) {
if (strcasecmp("dock", bar->mode) == 0) { if (strcasecmp("dock", bar->mode) == 0) {
bar->mode = strdup("hide"); bar->mode = strdup("hide");
} else if (strcasecmp("hide", bar->mode) == 0) { } else{
bar->mode = strdup("dock"); bar->mode = strdup("dock");
} }
} else if (strcasecmp("dock", mode) == 0) { } else if (strcasecmp("dock", mode) == 0) {

Loading…
Cancel
Save