aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2021-07-14 18:51:42 +0000
committerDaniel Eklöf <daniel@ekloef.se>2021-07-14 18:51:42 +0000
commit22651ed2217632a34bb9045306fac6ab9a2b3414 (patch)
tree77c96d07f79f6c2a10812f1e1e82ab509a52cb9c
parentrender: tiocswinsz: don’t remove/close the fd passed as argument (diff)
shm: reset buffer pool FD when we close it
This fixes an issue where we ended up "double closing" buffer FDs. In many cases (especially on compositors with SSDs) this was pretty rare. And even when it did happen, the FD was normally unused, and thus nothing bad happened. However, by quickly resizing the window while using CSDs, it was fairly easy to trigger this. We sometimes ended up closing the TIOCSWINCH timer FD while thinking it was a buffer FD, but most of the times we just ended up closing _another_ buffer’s pool FD, leading to an immediate disconnect by the compositor.
-rw-r--r--shm.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/shm.c b/shm.c
index 00804400..cad60aae 100644
--- a/shm.c
+++ b/shm.c
@@ -420,6 +420,7 @@ shm_get_buffer(struct wl_shm *shm, int width, int height, unsigned long cookie,
/* We only need to keep the pool FD open if we’re going to SHM
* scroll it */
close(pool_fd);
+ ret->fd = -1;
}
return ret;