gtk: prevent double free when closing window

This commit is contained in:
Jeffrey C. Ollie
2025-02-16 13:55:41 -06:00
parent bf7e9603d2
commit 497a1b6f8f

View File

@ -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();
}
}