aboutsummaryrefslogtreecommitdiff
path: root/sway
diff options
context:
space:
mode:
authorDrew DeVault <sir@cmpwn.com>2018-03-31 00:35:06 -0400
committerDrew DeVault <sir@cmpwn.com>2018-03-31 00:35:06 -0400
commit18173fb5ade5af0d09a3e270701207f55bb5f97e (patch)
treed4757df0da8c678464171a294f1ed02288b0733d /sway
parent0441d124799dca510b3bf6621267b7838730af1a (diff)
Free bar configs on reload and exit
Diffstat (limited to 'sway')
-rw-r--r--sway/config.c17
-rw-r--r--sway/config/bar.c2
2 files changed, 12 insertions, 7 deletions
diff --git a/sway/config.c b/sway/config.c
index 347d9e73..e9e7057d 100644
--- a/sway/config.c
+++ b/sway/config.c
@@ -57,38 +57,41 @@ static void free_mode(struct sway_mode *mode) {
void free_config(struct sway_config *config) {
config_clear_handler_context(config);
- int i;
-
if (!config) {
return;
}
// TODO: handle all currently unhandled lists as we add implementations
if (config->symbols) {
- for (i = 0; i < config->symbols->length; i++) {
+ for (int i = 0; i < config->symbols->length; ++i) {
free_sway_variable(config->symbols->items[i]);
}
list_free(config->symbols);
}
if (config->modes) {
- for (i = 0; i < config->modes->length; i++) {
+ for (int i = 0; i < config->modes->length; ++i) {
free_mode(config->modes->items[i]);
}
list_free(config->modes);
}
- list_free(config->bars);
+ if (config->bars) {
+ for (int i = 0; i < config->bars->length; ++i) {
+ free_bar_config(config->bars->items[i]);
+ }
+ list_free(config->bars);
+ }
list_free(config->cmd_queue);
list_free(config->workspace_outputs);
list_free(config->pid_workspaces);
list_free(config->output_configs);
if (config->input_configs) {
- for (i = 0; i < config->input_configs->length; i++) {
+ for (int i = 0; i < config->input_configs->length; i++) {
free_input_config(config->input_configs->items[i]);
}
list_free(config->input_configs);
}
if (config->seat_configs) {
- for (i = 0; i < config->seat_configs->length; i++) {
+ for (int i = 0; i < config->seat_configs->length; i++) {
free_seat_config(config->seat_configs->items[i]);
}
list_free(config->seat_configs);
diff --git a/sway/config/bar.c b/sway/config/bar.c
index 48b2fc7c..2913f059 100644
--- a/sway/config/bar.c
+++ b/sway/config/bar.c
@@ -16,6 +16,7 @@
#include "log.h"
static void terminate_swaybar(pid_t pid) {
+ wlr_log(L_DEBUG, "Terminating swaybar %d", pid);
int ret = kill(pid, SIGTERM);
if (ret != 0) {
wlr_log_errno(L_ERROR, "Unable to terminate swaybar %d", pid);
@@ -185,6 +186,7 @@ void invoke_swaybar(struct bar_config *bar) {
execvp(cmd[0], cmd);
exit(1);
}
+ wlr_log(L_DEBUG, "Spawned swaybar %d", bar->pid);
close(filedes[0]);
ssize_t len;
if (read(filedes[1], &len, sizeof(int)) == sizeof(int)) {