From a3bb2df94f2e8576e689d247f54c68c7bb88a711 Mon Sep 17 00:00:00 2001 From: Michael Himing Date: Sun, 12 Jan 2025 14:46:05 +1100 Subject: [PATCH] fix(gtk): fix segfault on ctrl-d on older adw --- src/apprt/gtk/notebook_adw.zig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/apprt/gtk/notebook_adw.zig b/src/apprt/gtk/notebook_adw.zig index 89a316332..790b3aa35 100644 --- a/src/apprt/gtk/notebook_adw.zig +++ b/src/apprt/gtk/notebook_adw.zig @@ -137,6 +137,8 @@ pub const NotebookAdw = struct { // If we have no more tabs we close the window if (self.nPages() == 0) { + const window = 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 @@ -150,7 +152,7 @@ pub const NotebookAdw = struct { // `self` will become invalid after this call because it will have // been freed up as part of the process of closing the window. - c.gtk_window_destroy(tab.window.window); + c.gtk_window_destroy(window); } } };