aboutsummaryrefslogtreecommitdiffstats
path: root/sway/desktop/output.c
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/desktop/output.c
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/desktop/output.c')
-rw-r--r--sway/desktop/output.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sway/desktop/output.c b/sway/desktop/output.c
index 790751c3..34fefaa9 100644
--- a/sway/desktop/output.c
+++ b/sway/desktop/output.c
@@ -1271,6 +1271,8 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
1271 wl_list_remove(&output->destroy.link); 1271 wl_list_remove(&output->destroy.link);
1272 output->wlr_output->data = NULL; 1272 output->wlr_output->data = NULL;
1273 free(output); 1273 free(output);
1274
1275 arrange_and_commit(&root_container);
1274} 1276}
1275 1277
1276static void handle_mode(struct wl_listener *listener, void *data) { 1278static void handle_mode(struct wl_listener *listener, void *data) {