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
This commit is contained in:
Daniel Boles 2017-10-06 01:27:14 +01:00
parent 6c3d17b867
commit 7fc09f18a3

View File

@ -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);