[gnome-control-center] color: Don't update toolbar buttons when the toolbar is in destruction



commit 200e524aaba2fff7c8346b4dc6b36fe7c5a69815
Author: Christopher Davis <christopherdavis gnome org>
Date:   Mon Jan 31 16:46:45 2022 -0800

    color: Don't update toolbar buttons when the toolbar is in destruction
    
    GtkListBox's dispose function removes all rows, and
    `gtk_list_box_remove ()` sends `row-selected`. In turn,
    as we listen to row-selected, we end up calling
    functions on our toolbar while it may be in the
    process of disposing. This causes a crash.
    
    This commit introduces an early return if the toolbar is
    being destroyed.

 panels/color/cc-color-panel.c | 3 +++
 1 file changed, 3 insertions(+)
---
diff --git a/panels/color/cc-color-panel.c b/panels/color/cc-color-panel.c
index c70d953c7..f55fcf93b 100644
--- a/panels/color/cc-color-panel.c
+++ b/panels/color/cc-color-panel.c
@@ -1704,6 +1704,9 @@ static void
 gcm_prefs_list_box_row_selected_cb (CcColorPanel *panel,
                                     GtkListBoxRow *row)
 {
+  if (gtk_widget_in_destruction (panel->toolbar_devices))
+    return;
+
   gcm_prefs_refresh_toolbar_buttons (panel);
 }
 


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