From 75e989dab6c7a5bea9b7f7b406513ffd105a14e2 Mon Sep 17 00:00:00 2001 From: Christian Rauch Date: Tue, 12 May 2020 23:04:50 +0100 Subject: GHOST: fix cursor buffer handling when toggling visibility --- intern/ghost/intern/GHOST_SystemWayland.cpp | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'intern') diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp b/intern/ghost/intern/GHOST_SystemWayland.cpp index 1ec63a0a41b..a450805c43c 100644 --- a/intern/ghost/intern/GHOST_SystemWayland.cpp +++ b/intern/ghost/intern/GHOST_SystemWayland.cpp @@ -167,6 +167,9 @@ 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); } @@ -1612,15 +1615,18 @@ GHOST_TSuccess GHOST_SystemWayland::setCursorVisibility(bool visible) return GHOST_kFailure; } - cursor_t *cursor = &d->inputs[0]->cursor; + input_t *input = d->inputs[0]; + + cursor_t *cursor = &input->cursor; if (visible) { if (!cursor->visible) { - set_cursor_buffer(d->inputs[0], d->inputs[0]->cursor.buffer); + set_cursor_buffer(input, cursor->buffer); } } else { if (cursor->visible) { - set_cursor_buffer(d->inputs[0], nullptr); + set_cursor_buffer(input, nullptr); + cursor->buffer = nullptr; } } -- cgit v1.2.3