mirror of
https://github.com/swaywm/sway.git
synced 2024-11-13 05:54:11 +01:00
Destroy swaybg client on reload
When reloading, this destroys the old config's swaybg client before spawning the new config's swaybg. This fixes a race condition where the old config's swaybg client's destroy was being called after the new config's swaybg client was being spawned. This was causing the reference to the new swaybg client to be removed and never destroyed. This also modifies handle_swaybg_client_destroy to grab the config reference using wl_container_of on the listener since the swaybg client may be the old config swaybg client and should be used instead of the global config instance
This commit is contained in:
parent
d3506604e8
commit
184663c98f
@ -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);
|
||||
}
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user