[gtk+/gtk-3-22] ComboBox: Don’t let modes disconnect each other



commit 7fc09f18a32cf38abfbecc45c5d6b7af459244fa
Author: Daniel Boles <dboles src gnome org>
Date:   Fri Oct 6 01:27:14 2017 +0100

    ComboBox: Don’t let modes disconnect each other
    
    …from priv->button. My refactor to g_signal_disconnect_by_data()
    included this widget, when I shouldn’t have as both modes use it.
    This e.g. broke opening a CB by keyboard that was currently in menu
    mode, if it had been in list mode initially (e.g. due to the theme).
    
    Fix by moving to disconnect_by_func() and only removing in each mode’s
    destroy() method the signals that it set on the button in its setup().
    
    https://bugzilla.gnome.org/show_bug.cgi?id=788577

 gtk/gtkcombobox.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c
index aad70b2..2946ece 100644
--- a/gtk/gtkcombobox.c
+++ b/gtk/gtkcombobox.c
@@ -2775,7 +2775,12 @@ gtk_combo_box_menu_destroy (GtkComboBox *combo_box)
 {
   GtkComboBoxPrivate *priv = combo_box->priv;
 
-  g_signal_handlers_disconnect_by_data (priv->button, combo_box);
+  g_signal_handlers_disconnect_by_func (priv->button,
+                                        gtk_combo_box_menu_button_press,
+                                        combo_box);
+  g_signal_handlers_disconnect_by_func (priv->button,
+                                        gtk_combo_box_button_state_flags_changed,
+                                        combo_box);
   g_signal_handlers_disconnect_by_data (priv->popup_widget, combo_box);
 
   /* changing the popup window will unref the menu and the children */
@@ -3042,7 +3047,9 @@ gtk_combo_box_list_destroy (GtkComboBox *combo_box)
   GtkComboBoxPrivate *priv = combo_box->priv;
 
   /* disconnect signals */
-  g_signal_handlers_disconnect_by_data (priv->button, combo_box);
+  g_signal_handlers_disconnect_by_func (priv->button,
+                                        gtk_combo_box_list_button_pressed,
+                                        combo_box);
   g_signal_handlers_disconnect_by_data (priv->tree_view, combo_box);
   g_signal_handlers_disconnect_by_data (priv->popup_window, combo_box);
 


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