mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-10-15 22:36:14 +00:00
gtk/CommandPalette: prevent leaks on initialization
* Deallocate the builder after use * Don't hold a reference to `Command` after appending to `GListStore`
This commit is contained in:
@@ -43,6 +43,7 @@ pub fn init(self: *CommandPalette, window: *Window) !void {
|
|||||||
_ = Command.getGObjectType();
|
_ = Command.getGObjectType();
|
||||||
|
|
||||||
var builder = Builder.init("command-palette", 1, 5);
|
var builder = Builder.init("command-palette", 1, 5);
|
||||||
|
defer builder.deinit();
|
||||||
|
|
||||||
self.* = .{
|
self.* = .{
|
||||||
.window = window,
|
.window = window,
|
||||||
@@ -120,7 +121,9 @@ pub fn updateConfig(self: *CommandPalette, config: *const configpkg.Config) !voi
|
|||||||
command,
|
command,
|
||||||
config.keybind.set,
|
config.keybind.set,
|
||||||
);
|
);
|
||||||
self.source.append(cmd.as(gobject.Object));
|
const cmd_ref = cmd.as(gobject.Object);
|
||||||
|
self.source.append(cmd_ref);
|
||||||
|
cmd_ref.unref();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user