From 497a1b6f8f21fbfa1d7e954537f59b6f56d8e774 Mon Sep 17 00:00:00 2001 From: "Jeffrey C. Ollie" Date: Sun, 16 Feb 2025 13:55:41 -0600 Subject: [PATCH] gtk: prevent double free when closing window --- src/apprt/gtk/TabView.zig | 6 ------ 1 file changed, 6 deletions(-) diff --git a/src/apprt/gtk/TabView.zig b/src/apprt/gtk/TabView.zig index c702b0513..a024c0092 100644 --- a/src/apprt/gtk/TabView.zig +++ b/src/apprt/gtk/TabView.zig @@ -196,8 +196,6 @@ pub fn closeTab(self: *TabView, tab: *Tab) void { // If we have no more tabs we close the window if (self.nPages() == 0) { - const window: *gtk.Window = @ptrCast(@alignCast(tab.window.window)); - // libadw versions <= 1.3.x leak the final page view // which causes our surface to not properly cleanup. We // unref to force the cleanup. This will trigger a critical @@ -209,10 +207,6 @@ pub fn closeTab(self: *TabView, tab: *Tab) void { const box: *gtk.Box = @ptrCast(@alignCast(tab.box)); box.as(gobject.Object).unref(); } - - // `self` will become invalid after this call because it will have - // been freed up as part of the process of closing the window. - window.destroy(); } }