diff --git a/src/apprt/gtk/Surface.zig b/src/apprt/gtk/Surface.zig index e13871050..848dd02a5 100644 --- a/src/apprt/gtk/Surface.zig +++ b/src/apprt/gtk/Surface.zig @@ -387,6 +387,12 @@ pub fn deinit(self: *Surface) void { if (self.cursor) |cursor| c.g_object_unref(cursor); } +// shutdown removes the long-held reference to the gl_area and kicks off the +// deinit/destroy process for this surface. +pub fn shutdown(self: *Surface) void { + c.g_object_unref(self.gl_area); +} + // TODO: move this /// Change the container for the surface to `container`. pub fn setContainer(self: *Surface, container: Container) void { diff --git a/src/apprt/gtk/Tab.zig b/src/apprt/gtk/Tab.zig index 1a0d52a13..d1d33893a 100644 --- a/src/apprt/gtk/Tab.zig +++ b/src/apprt/gtk/Tab.zig @@ -151,7 +151,8 @@ pub fn init(self: *Tab, window: *Window, parent_: ?*CoreSurface) !void { /// Deinits tab by deiniting child if child is Paned. pub fn deinit(self: *Tab) void { switch (self.child) { - .none, .surface => return, + .none => return, + .surface => |s| s.shutdown(), .paned => |paned| { paned.deinit(self.window.app.core_app.alloc); self.window.app.core_app.alloc.destroy(paned);