diff options
Diffstat (limited to 'client')
-rw-r--r-- | client/pool-buffer.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/client/pool-buffer.c b/client/pool-buffer.c index 7610d223..52438303 100644 --- a/client/pool-buffer.c +++ b/client/pool-buffer.c | |||
@@ -72,7 +72,7 @@ static struct pool_buffer *create_buffer(struct wl_shm *shm, | |||
72 | struct pool_buffer *buf, int32_t width, int32_t height, | 72 | struct pool_buffer *buf, int32_t width, int32_t height, |
73 | uint32_t format) { | 73 | uint32_t format) { |
74 | uint32_t stride = width * 4; | 74 | uint32_t stride = width * 4; |
75 | uint32_t size = stride * height; | 75 | size_t size = stride * height; |
76 | 76 | ||
77 | char *name; | 77 | char *name; |
78 | int fd = create_pool_file(size, &name); | 78 | int fd = create_pool_file(size, &name); |
@@ -87,8 +87,10 @@ static struct pool_buffer *create_buffer(struct wl_shm *shm, | |||
87 | free(name); | 87 | free(name); |
88 | fd = -1; | 88 | fd = -1; |
89 | 89 | ||
90 | buf->size = size; | ||
90 | buf->width = width; | 91 | buf->width = width; |
91 | buf->height = height; | 92 | buf->height = height; |
93 | buf->data = data; | ||
92 | buf->surface = cairo_image_surface_create_for_data(data, | 94 | buf->surface = cairo_image_surface_create_for_data(data, |
93 | CAIRO_FORMAT_ARGB32, width, height, stride); | 95 | CAIRO_FORMAT_ARGB32, width, height, stride); |
94 | buf->cairo = cairo_create(buf->surface); | 96 | buf->cairo = cairo_create(buf->surface); |
@@ -111,6 +113,9 @@ void destroy_buffer(struct pool_buffer *buffer) { | |||
111 | if (buffer->pango) { | 113 | if (buffer->pango) { |
112 | g_object_unref(buffer->pango); | 114 | g_object_unref(buffer->pango); |
113 | } | 115 | } |
116 | if (buffer->data) { | ||
117 | munmap(buffer->data, buffer->size); | ||
118 | } | ||
114 | memset(buffer, 0, sizeof(struct pool_buffer)); | 119 | memset(buffer, 0, sizeof(struct pool_buffer)); |
115 | } | 120 | } |
116 | 121 | ||