ComboBox: Fix wrongly matched signal disconnect()s

Various disconnections had the wrong flags and/or data, so we failed to
disconnect a pile of signals, shown by 0 returned by the disconnect_*()
functions. Fix this, and use the nicer disconnect_by_*() while here.
This commit is contained in:
Daniel Boles 2017-08-28 18:57:27 +01:00
parent 1301723905
commit 1f1fdfe757

View File

@ -1861,10 +1861,10 @@ gtk_combo_box_set_popup_widget (GtkComboBox *combo_box,
gtk_window_set_type_hint (GTK_WINDOW (priv->popup_window), gtk_window_set_type_hint (GTK_WINDOW (priv->popup_window),
GDK_WINDOW_TYPE_HINT_COMBO); GDK_WINDOW_TYPE_HINT_COMBO);
g_signal_connect (GTK_WINDOW (priv->popup_window),"show", g_signal_connect (priv->popup_window, "show",
G_CALLBACK (gtk_combo_box_child_show), G_CALLBACK (gtk_combo_box_child_show),
combo_box); combo_box);
g_signal_connect (GTK_WINDOW (priv->popup_window),"hide", g_signal_connect (priv->popup_window, "hide",
G_CALLBACK (gtk_combo_box_child_hide), G_CALLBACK (gtk_combo_box_child_hide),
combo_box); combo_box);
@ -2792,17 +2792,11 @@ gtk_combo_box_menu_destroy (GtkComboBox *combo_box)
{ {
GtkComboBoxPrivate *priv = combo_box->priv; GtkComboBoxPrivate *priv = combo_box->priv;
g_signal_handlers_disconnect_matched (priv->button, g_signal_handlers_disconnect_by_func (priv->button,
G_SIGNAL_MATCH_DATA, gtk_combo_box_menu_button_press, combo_box);
0, 0, NULL, g_signal_handlers_disconnect_by_func (priv->button,
gtk_combo_box_menu_button_press, NULL);
g_signal_handlers_disconnect_matched (priv->button,
G_SIGNAL_MATCH_DATA,
0, 0, NULL,
gtk_combo_box_button_state_flags_changed, combo_box); gtk_combo_box_button_state_flags_changed, combo_box);
g_signal_handlers_disconnect_matched (priv->popup_widget, g_signal_handlers_disconnect_by_func (priv->popup_widget,
G_SIGNAL_MATCH_DATA,
0, 0, NULL,
gtk_combo_box_menu_activate, combo_box); gtk_combo_box_menu_activate, combo_box);
/* changing the popup window will unref the menu and the children */ /* changing the popup window will unref the menu and the children */
@ -3069,36 +3063,11 @@ gtk_combo_box_list_destroy (GtkComboBox *combo_box)
GtkComboBoxPrivate *priv = combo_box->priv; GtkComboBoxPrivate *priv = combo_box->priv;
/* disconnect signals */ /* disconnect signals */
g_signal_handlers_disconnect_matched (priv->tree_view, g_signal_handlers_disconnect_by_data (priv->tree_view, combo_box);
G_SIGNAL_MATCH_DATA, g_signal_handlers_disconnect_by_func (priv->button,
0, 0, NULL, NULL, combo_box);
g_signal_handlers_disconnect_matched (priv->button,
G_SIGNAL_MATCH_DATA,
0, 0, NULL,
gtk_combo_box_list_button_pressed, gtk_combo_box_list_button_pressed,
NULL); combo_box);
g_signal_handlers_disconnect_matched (priv->popup_window, g_signal_handlers_disconnect_by_data (priv->popup_window, combo_box);
G_SIGNAL_MATCH_DATA,
0, 0, NULL,
gtk_combo_box_list_button_pressed,
NULL);
g_signal_handlers_disconnect_matched (priv->popup_window,
G_SIGNAL_MATCH_DATA,
0, 0, NULL,
gtk_combo_box_list_button_released,
NULL);
g_signal_handlers_disconnect_matched (priv->popup_window,
G_SIGNAL_MATCH_DATA,
0, 0, NULL,
gtk_combo_box_child_show,
NULL);
g_signal_handlers_disconnect_matched (priv->popup_window,
G_SIGNAL_MATCH_DATA,
0, 0, NULL,
gtk_combo_box_child_hide,
NULL);
if (priv->cell_view) if (priv->cell_view)
{ {