mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 08:46:08 +03:00
gtk: move surface destroy through deref
This commit is contained in:

committed by
Mitchell Hashimoto

parent
236e57a1f4
commit
3fef4fce56
@ -223,7 +223,9 @@ pub fn init(self: *Surface, app: *App, opts: Options) !void {
|
||||
// GL area be moved around i.e. between a split, a tab, etc.
|
||||
// without having to be really careful about ordering to
|
||||
// prevent a destroy.
|
||||
// TODO: unref in deinit
|
||||
//
|
||||
// This is unref'd in the unref() method that's called by the
|
||||
// self.container through Elem.deinit.
|
||||
_ = c.g_object_ref_sink(@ptrCast(gl_area));
|
||||
errdefer c.g_object_unref(@ptrCast(gl_area));
|
||||
|
||||
@ -375,11 +377,6 @@ fn realize(self: *Surface) !void {
|
||||
self.realized = true;
|
||||
}
|
||||
|
||||
pub fn destroy(self: *Surface, alloc: Allocator) void {
|
||||
self.deinit();
|
||||
alloc.destroy(self);
|
||||
}
|
||||
|
||||
pub fn deinit(self: *Surface) void {
|
||||
// We don't allocate anything if we aren't realized.
|
||||
if (!self.realized) return;
|
||||
|
@ -96,7 +96,7 @@ pub fn init(self: *Tab, window: *Window, parent_: ?*CoreSurface) !void {
|
||||
var surface = try Surface.create(window.app.core_app.alloc, window.app, .{
|
||||
.parent2 = parent_,
|
||||
});
|
||||
errdefer surface.destroy(window.app.core_app.alloc);
|
||||
errdefer surface.unref();
|
||||
surface.setContainer(.{ .tab_ = self });
|
||||
self.elem = .{ .surface = surface };
|
||||
|
||||
|
Reference in New Issue
Block a user