[Bf-blender-cvs] [a17f74ab341] master: Fix memory leak plugging in new keyboards in wayland

Campbell Barton noreply at git.blender.org
Thu Jun 16 06:56:56 CEST 2022


Commit: a17f74ab341b026387fef6b741e3c0901780526c
Author: Campbell Barton
Date:   Thu Jun 16 14:55:37 2022 +1000
Branches: master
https://developer.blender.org/rBa17f74ab341b026387fef6b741e3c0901780526c

Fix memory leak plugging in new keyboards in wayland

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

M	intern/ghost/intern/GHOST_SystemWayland.cpp

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

diff --git a/intern/ghost/intern/GHOST_SystemWayland.cpp b/intern/ghost/intern/GHOST_SystemWayland.cpp
index cf5ba550e55..93d85f33dda 100644
--- a/intern/ghost/intern/GHOST_SystemWayland.cpp
+++ b/intern/ghost/intern/GHOST_SystemWayland.cpp
@@ -1607,8 +1607,13 @@ static void keyboard_handle_keymap(
     return;
   }
 
-  input->xkb_state = xkb_state_new(keymap);
-
+  struct xkb_state *xkb_state_next = xkb_state_new(keymap);
+  if (xkb_state_next) {
+    if (input->xkb_state) {
+      xkb_state_unref(input->xkb_state);
+    }
+    input->xkb_state = xkb_state_next;
+  }
   xkb_keymap_unref(keymap);
 }



More information about the Bf-blender-cvs mailing list