mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-14 07:46:12 +03:00
gtk: add some comments about closing the last tab invaldating self pointer
This commit is contained in:
@ -127,6 +127,8 @@ pub const NotebookAdw = struct {
|
|||||||
self.forcing_close = true;
|
self.forcing_close = true;
|
||||||
const n = self.nPages();
|
const n = self.nPages();
|
||||||
defer {
|
defer {
|
||||||
|
// self becomes invalid if we close the last page because we close
|
||||||
|
// the whole window
|
||||||
if (n > 1) self.forcing_close = false;
|
if (n > 1) self.forcing_close = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,6 +148,8 @@ pub const NotebookAdw = struct {
|
|||||||
c.g_object_unref(tab.box);
|
c.g_object_unref(tab.box);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// `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(tab.window.window);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user