mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
gtk: prevent double free when closing window
This commit is contained in:
@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user