diff options
author | Mikkel Oscar Lyderik <mikkeloscar@gmail.com> | 2016-02-24 18:53:09 +0100 |
---|---|---|
committer | Mikkel Oscar Lyderik <mikkeloscar@gmail.com> | 2016-02-27 22:13:15 +0100 |
commit | 67bbcceba1433e41b5edfca32532b7d55a39a395 (patch) | |
tree | 6be69c67c3fbdc9cb320dd7d34b26564ff486a67 | |
parent | e15a8a03769736f588f68ae5e1cc24611ed334ae (diff) | |
download | sway-67bbcceba1433e41b5edfca32532b7d55a39a395.tar.xz |
Free config before exiting sway.
Apart from freeing the sway_config struct, this also terminates the
swaybars spawned by sway, since they are linked by PID to the bar config
structs.
-rw-r--r-- | include/config.h | 4 | ||||
-rw-r--r-- | sway/config.c | 2 | ||||
-rw-r--r-- | sway/main.c | 4 |
3 files changed, 9 insertions, 1 deletions
diff --git a/include/config.h b/include/config.h index 8907e019..d77872ee 100644 --- a/include/config.h +++ b/include/config.h @@ -193,6 +193,10 @@ bool load_config(const char *file); */ bool read_config(FILE *file, bool is_active); /** + * Free config struct + */ +void free_config(struct sway_config *config); +/** * Does variable replacement for a string based on the config's currently loaded variables. */ char *do_var_replacement(char *str); diff --git a/sway/config.c b/sway/config.c index 16adaf0d..296e164c 100644 --- a/sway/config.c +++ b/sway/config.c @@ -86,7 +86,7 @@ static void free_workspace_output(struct workspace_output *wo) { free(wo); } -static void free_config(struct sway_config *config) { +void free_config(struct sway_config *config) { int i; for (i = 0; i < config->symbols->length; ++i) { free_variable(config->symbols->items[i]); diff --git a/sway/main.c b/sway/main.c index 7ea392b6..7c712281 100644 --- a/sway/main.c +++ b/sway/main.c @@ -228,6 +228,10 @@ int main(int argc, char **argv) { ipc_terminate(); + if (config) { + free_config(config); + } + return exit_value; } |