gtk: add some comments about closing the last tab invaldating self pointer

pull/4926/head
Jeffrey C. Ollie 2025-01-10 19:19:11 -06:00
parent 16233b16e7
commit 0a26321e9d
No known key found for this signature in database
GPG Key ID: 6F86035A6D97044E
1 changed files with 4 additions and 0 deletions

View File

@ -127,6 +127,8 @@ pub const NotebookAdw = struct {
self.forcing_close = true;
const n = self.nPages();
defer {
// self becomes invalid if we close the last page because we close
// the whole window
if (n > 1) self.forcing_close = false;
}
@ -146,6 +148,8 @@ pub const NotebookAdw = struct {
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);
}
}