diff --git a/src/apprt/gtk/Surface.zig b/src/apprt/gtk/Surface.zig index 40167d1e1..5640ff5a2 100644 --- a/src/apprt/gtk/Surface.zig +++ b/src/apprt/gtk/Surface.zig @@ -280,7 +280,7 @@ fn realize(self: *Surface) !void { pub fn destroy(self: *Surface, alloc: Allocator) void { self.deinit(); - alloc.free(self); + alloc.destroy(self); } pub fn deinit(self: *Surface) void { diff --git a/src/apprt/gtk/Tab.zig b/src/apprt/gtk/Tab.zig index b1abbfbf2..d480abbff 100644 --- a/src/apprt/gtk/Tab.zig +++ b/src/apprt/gtk/Tab.zig @@ -90,8 +90,12 @@ pub fn init(self: *Tab, window: *Window, parent_: ?*CoreSurface) !void { self.box = @ptrCast(box_widget); // Create the initial surface since all tabs start as a single non-split - const surface = try self.newSurface(parent_); - errdefer surface.deinit(); + var surface = try Surface.create(window.app.core_app.alloc, window.app, .{ + .parent2 = parent_, + .parent = .{ .tab = self }, + }); + errdefer surface.destroy(window.app.core_app.alloc); + surface.setContainer(.{ .tab_ = self }); self.child = .{ .surface = surface }; // Add Surface to the Tab