apprt/gtk: get rid of one newsurface call

This commit is contained in:
Mitchell Hashimoto
2023-11-01 22:43:49 -07:00
parent f1547465cc
commit 83b0096dfc
2 changed files with 7 additions and 3 deletions

View File

@ -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 {

View File

@ -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