diff --git a/sway/config.c b/sway/config.c index 64093aca..4f92b403 100644 --- a/sway/config.c +++ b/sway/config.c @@ -441,6 +441,10 @@ bool load_main_config(const char *file, bool is_active, bool validating) { config->reloading = true; config->active = true; + if (old_config->swaybg_client != NULL) { + wl_client_destroy(old_config->swaybg_client); + } + if (old_config->swaynag_config_errors.client != NULL) { wl_client_destroy(old_config->swaynag_config_errors.client); } diff --git a/sway/config/output.c b/sway/config/output.c index fb8a9ee5..0022485b 100644 --- a/sway/config/output.c +++ b/sway/config/output.c @@ -482,9 +482,11 @@ void free_output_config(struct output_config *oc) { static void handle_swaybg_client_destroy(struct wl_listener *listener, void *data) { - wl_list_remove(&config->swaybg_client_destroy.link); - wl_list_init(&config->swaybg_client_destroy.link); - config->swaybg_client = NULL; + struct sway_config *sway_config = + wl_container_of(listener, sway_config, swaybg_client_destroy); + wl_list_remove(&sway_config->swaybg_client_destroy.link); + wl_list_init(&sway_config->swaybg_client_destroy.link); + sway_config->swaybg_client = NULL; } static bool _spawn_swaybg(char **command) {