From 9ceabdab80144a74ed82ac82dfd071967f274ade Mon Sep 17 00:00:00 2001 From: Alice Mikhaylenko Date: Fri, 31 Jan 2025 17:11:24 +0000 Subject: [PATCH 22/33] dialog: always clear priv->last_focus weak pointer Currently we're relying on the last-focused widget to never outlive the AdwDialog. In fairness, this would be unusual, but it's always possible and the penalty for being wrong is memory corruption, and that is a very harsh penalty. (cherry picked from commit 406c76d12d8b4737d4e41e007ed77aebb77a1ac7) Co-authored-by: Michael Catanzaro --- src/adw-dialog.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/adw-dialog.c b/src/adw-dialog.c index 0bc3f2a9..7cd2a454 100644 --- a/src/adw-dialog.c +++ b/src/adw-dialog.c @@ -870,6 +870,8 @@ adw_dialog_dispose (GObject *object) priv->focus_widget = NULL; } + g_clear_weak_pointer (&priv->last_focus); + if (priv->default_widget) { g_signal_handlers_disconnect_by_func (priv->default_widget, unset_default_widget, self); -- 2.47.1