aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRouven Czerwinski <rouven@czerwinskis.de>2019-02-10 17:04:12 +0100
committerDrew DeVault <sir@cmpwn.com>2019-02-11 10:22:53 -0500
commit95e16bb744679296aaab5c0e9b8f3995fb2b4be4 (patch)
treed25161803fa047ae74297dd374005fe3915fd4f9
parent243d5a3a435c2786ecfa305e30fbca658e1861ff (diff)
downloadsway-95e16bb744679296aaab5c0e9b8f3995fb2b4be4.zip
sway-95e16bb744679296aaab5c0e9b8f3995fb2b4be4.tar.gz
sway-95e16bb744679296aaab5c0e9b8f3995fb2b4be4.tar.bz2
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
-rw-r--r--sway/commands/bar/mode.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sway/commands/bar/mode.c b/sway/commands/bar/mode.c
index d89ddf2..68a80ab 100644
--- a/sway/commands/bar/mode.c
+++ b/sway/commands/bar/mode.c
@@ -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("dock", bar->mode) == 0) {
bar->mode = strdup("hide");
- } else if (strcasecmp("hide", bar->mode) == 0) {
+ } else{
bar->mode = strdup("dock");
}
} else if (strcasecmp("dock", mode) == 0) {