[Bf-blender-cvs] [75e989dab6c] master: GHOST: fix cursor buffer handling when toggling visibility

Christian Rauch noreply at git.blender.org
Wed May 13 00:10:27 CEST 2020


Commit: 75e989dab6c7a5bea9b7f7b406513ffd105a14e2
Author: Christian Rauch
Date:   Tue May 12 23:04:50 2020 +0100
Branches: master
https://developer.blender.org/rB75e989dab6c7a5bea9b7f7b406513ffd105a14e2

GHOST: fix cursor buffer handling when toggling visibility

===================================================================

M	intern/ghost/intern/GHOST_SystemWayland.cpp

===================================================================

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;
     }
   }



More information about the Bf-blender-cvs mailing list