[PATCH weston] Copying xkb_info when creating a seat causes problems

Andrew Wedgbury andrew.wedgbury at realvnc.com
Wed Sep 4 05:49:03 PDT 2013


A simpler fix would be to not call xkb_info_destroy() when releasing a seat in the case where the xkb_info for the seat was copied from the global compositor settings (which can be determined by checking if keymap_fd is the same)

In this case, xkb_map_unref() should still be called to unref the keymap.

This appears to fix things for me, so I can now create and destroy many seats.

---
 src/input.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/input.c b/src/input.c
index 325a48f..d99798e 100644
--- a/src/input.c
+++ b/src/input.c
@@ -1600,7 +1600,12 @@ weston_seat_release(struct weston_seat *seat)
        if (seat->compositor->use_xkbcommon) {
                if (seat->xkb_state.state != NULL)
                        xkb_state_unref(seat->xkb_state.state);
-               xkb_info_destroy(&seat->xkb_info);
+
+               if (seat->xkb_info.keymap_fd != 
+                   seat->compositor->xkb_info.keymap_fd)
+                       xkb_info_destroy(&seat->xkb_info);
+               else if (seat->xkb_info.keymap)
+                       xkb_map_unref(seat->xkb_info.keymap);
        }
 #endif
 
-- 
1.7.10.4


More information about the wayland-devel mailing list