[libadwaita/libadwaita-1-0] split-button: avoid state changes during dispose



commit a61a9fd25c89d09e87c90fd28dcccc6b8012bf72
Author: Christian Hergert <chergert redhat com>
Date:   Wed Mar 30 00:54:19 2022 -0700

    split-button: avoid state changes during dispose
    
    This avoids a critical that can fire when disposing and accessing widgets
    that are being destroyed resulting in action muxer updates.
    
    
    (cherry picked from commit 0b7172a987e06aa0c0d20b63766e92f020020676)
    
    (cherry picked from commit c980678756dfa1aa9671a57e7a02a78a20717a9b)

 src/adw-split-button.c | 7 +++++++
 1 file changed, 7 insertions(+)
---
diff --git a/src/adw-split-button.c b/src/adw-split-button.c
index 268d196b..0e9fc02b 100644
--- a/src/adw-split-button.c
+++ b/src/adw-split-button.c
@@ -88,6 +88,8 @@ struct _AdwSplitButton
   GtkWidget *menu_button;
   GtkWidget *arrow_button;
   GtkWidget *separator;
+
+  guint disposed : 1;
 };
 
 static void adw_split_button_actionable_init (GtkActionableInterface *iface);
@@ -105,6 +107,9 @@ update_state (AdwSplitButton *self)
   GtkStateFlags flags;
   gboolean keyboard_activating;
 
+  if (self->disposed)
+    return;
+
   flags = gtk_widget_get_state_flags (self->button) |
           gtk_widget_get_state_flags (self->arrow_button);
 
@@ -246,6 +251,8 @@ adw_split_button_dispose (GObject *object)
 {
   AdwSplitButton *self = ADW_SPLIT_BUTTON (object);
 
+  self->disposed = TRUE;
+
   g_clear_pointer (&self->button, gtk_widget_unparent);
   g_clear_pointer (&self->menu_button, gtk_widget_unparent);
   g_clear_pointer (&self->separator, gtk_widget_unparent);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]