~sircmpwn/public-inbox

wev: remember to close and unmap buffer after drawing v1 PROPOSED

Ronan Pigott: 1
 remember to close and unmap buffer after drawing

 1 files changed, 2 insertions(+), 0 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~sircmpwn/public-inbox/patches/11500/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH wev] remember to close and unmap buffer after drawing Export this patch

From: Ronan Pigott <rpigott@berkeley.edu>

So when you open wev and wiggle it about a bit in an interactive
resize it eats a bunch of memory before dieing of too many open files.
It looks like it was just forgotten to clean up the wl_buffer when
we're done. I think this is all that's needed.

---
 wev.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/wev.c b/wev.c
index 67df920..8a90917 100644
--- a/wev.c
+++ b/wev.c
@@ -531,6 +531,7 @@ static struct wl_buffer *create_buffer(struct wev_state *state) {
	struct wl_buffer *buffer = wl_shm_pool_create_buffer(pool, 0,
			state->width, state->height, stride, WL_SHM_FORMAT_XRGB8888);
	wl_shm_pool_destroy(pool);
	close(fd);

	for (int y = 0; y < state->height; ++y) {
		for (int x = 0; x < state->width; ++x) {
@@ -541,6 +542,7 @@ static struct wl_buffer *create_buffer(struct wev_state *state) {
			}
		}
	}
	munmap(data, size);

	wl_buffer_add_listener(buffer, &wl_buffer_listener, NULL);

-- 
2.27.0
Thanks!

To git@git.sr.ht:~sircmpwn/wev
   0be512f..cee3dfb  master -> master