Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Rauch <Rauch.Christian@gmx.de>2020-05-14 01:11:45 +0300
committerChristian Rauch <Rauch.Christian@gmx.de>2020-05-14 01:13:48 +0300
commita53917152eb0b81feda09fa4bc99602449d18c35 (patch)
treeef2963c6df7c226681f1921eab999c237597a2a1 /intern/ghost
parentbd3c842c5693b9237f25204fca5514bcc85ee81a (diff)
GHOST/wayland: fix cursor buffer deallocation
Diffstat (limited to 'intern/ghost')
-rw-r--r--intern/ghost/intern/GHOST_SystemWayland.cpp15
1 files changed, 7 insertions, 8 deletions
diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp b/intern/ghost/intern/GHOST_SystemWayland.cpp
index 3d8e623e51f..444c6010af0 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.cpp
+++ b/intern/ghost/intern/GHOST_SystemWayland.cpp
@@ -166,9 +166,6 @@ static void display_destroy(display_t *d)
munmap(input->cursor.file_buffer->data, input->cursor.file_buffer->size);
delete input->cursor.file_buffer;
}
- if (input->cursor.buffer) {
- wl_buffer_destroy(input->cursor.buffer);
- }
if (input->cursor.surface) {
wl_surface_destroy(input->cursor.surface);
}
@@ -755,13 +752,16 @@ static const struct wl_data_device_listener data_device_listener = {
data_device_selection,
};
-static void buffer_release(void * /*data*/, struct wl_buffer *wl_buffer)
+static void cursor_buffer_release(void * data, struct wl_buffer *wl_buffer)
{
+ cursor_t *cursor = static_cast<cursor_t *>(data);
+
wl_buffer_destroy(wl_buffer);
+ cursor->buffer = nullptr;
}
-const struct wl_buffer_listener buffer_listener = {
- buffer_release,
+const struct wl_buffer_listener cursor_buffer_listener = {
+ cursor_buffer_release,
};
static void pointer_enter(void *data,
@@ -1565,7 +1565,7 @@ GHOST_TSuccess GHOST_SystemWayland::setCustomCursorShape(GHOST_TUns8 *bitmap,
wl_shm_pool_destroy(pool);
close(fd);
- wl_buffer_add_listener(buffer, &buffer_listener, nullptr);
+ wl_buffer_add_listener(buffer, &cursor_buffer_listener, cursor);
static constexpr uint32_t black = 0xFF000000;
static constexpr uint32_t white = 0xFFFFFFFF;
@@ -1625,7 +1625,6 @@ GHOST_TSuccess GHOST_SystemWayland::setCursorVisibility(bool visible)
else {
if (cursor->visible) {
set_cursor_buffer(input, nullptr);
- cursor->buffer = nullptr;
}
}