summaryrefslogtreecommitdiffstats
path: root/sway/tree
diff options
context:
space:
mode:
authorLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-06-26 19:40:42 +1000
committerLibravatar Ryan Dwyer <ryandwyer1@gmail.com>2018-06-26 19:40:42 +1000
commit834805f5e260bcc77d714323d4a7f4bfd1dbfb17 (patch)
treecc79849a31a7d90630559b39e4de321e6517f54b /sway/tree
parentRemove timer when transaction destroys (diff)
downloadsway-834805f5e260bcc77d714323d4a7f4bfd1dbfb17.tar.gz
sway-834805f5e260bcc77d714323d4a7f4bfd1dbfb17.tar.zst
sway-834805f5e260bcc77d714323d4a7f4bfd1dbfb17.zip
Fix crash when disconnecting output
We were freeing the sway_output immediately upon disconnect which left a dangling pointer in the output's container. It then tried to use the pointer when the container is freed. We don't need to store the sway_output in an output's container which is destroying, so the fix is to set the pointer to NULL and remove the use in container_free. Also added an arrange when the output is disconnected for good measure.
Diffstat (limited to 'sway/tree')
-rw-r--r--sway/tree/container.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/sway/tree/container.c b/sway/tree/container.c
index e30c7839..2f041a36 100644
--- a/sway/tree/container.c
+++ b/sway/tree/container.c
@@ -171,7 +171,6 @@ void container_free(struct sway_container *cont) {
171 case C_ROOT: 171 case C_ROOT:
172 break; 172 break;
173 case C_OUTPUT: 173 case C_OUTPUT:
174 cont->sway_output->swayc = NULL;
175 break; 174 break;
176 case C_WORKSPACE: 175 case C_WORKSPACE:
177 container_workspace_free(cont->sway_workspace); 176 container_workspace_free(cont->sway_workspace);
@@ -287,6 +286,7 @@ static struct sway_container *container_output_destroy(
287 wl_list_remove(&output->sway_output->damage_frame.link); 286 wl_list_remove(&output->sway_output->damage_frame.link);
288 287
289 output->sway_output->swayc = NULL; 288 output->sway_output->swayc = NULL;
289 output->sway_output = NULL;
290 290
291 wlr_log(L_DEBUG, "OUTPUT: Destroying output '%s'", output->name); 291 wlr_log(L_DEBUG, "OUTPUT: Destroying output '%s'", output->name);
292 292