diff --git a/src/apprt/gtk/winproto/wayland/Hotkeys.zig b/src/apprt/gtk/winproto/wayland/Hotkeys.zig index 700f0a385..ab3475bc8 100644 --- a/src/apprt/gtk/winproto/wayland/Hotkeys.zig +++ b/src/apprt/gtk/winproto/wayland/Hotkeys.zig @@ -106,7 +106,6 @@ fn bindOne( const entry = try self.alloc.create(Entry); errdefer self.alloc.destroy(entry); - try self.entries.ensureUnusedCapacity(self.alloc, 1); const hotkey = try manager.bind( keysym, @@ -120,6 +119,7 @@ fn bindOne( self.app_id.ptr, description.ptr, ); + errdefer hotkey.destroy(); entry.* = .{ .hotkey = hotkey, @@ -128,7 +128,7 @@ fn bindOne( .shortcuts = shortcuts, }; hotkey.setListener(*Entry, hotkeyListener, entry); - self.entries.appendAssumeCapacity(entry); + try self.entries.append(self.alloc, entry); } fn hotkeyListener(