mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2025-01-10 04:30:11 +00:00
ScrolledWindow: Fix non-disconnection of handlers
• Use disconnect_by_data() to catch both _adjustment_changed() and now _adjustment_value_changed(), as the latter had been missed until now. • Also disconnect from indicator_value_changed(), which was not done in destroy() due to indicator_reset() and remove_indicator() disagreeing. https://bugzilla.gnome.org/show_bug.cgi?id=775074
This commit is contained in:
parent
64d05b5dc6
commit
5dc5576e14
@ -2233,6 +2233,7 @@ gtk_scrolled_window_set_hadjustment (GtkScrolledWindow *scrolled_window,
|
||||
GtkWidget *child;
|
||||
|
||||
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
|
||||
|
||||
if (hadjustment)
|
||||
g_return_if_fail (GTK_IS_ADJUSTMENT (hadjustment));
|
||||
else
|
||||
@ -2257,13 +2258,14 @@ gtk_scrolled_window_set_hadjustment (GtkScrolledWindow *scrolled_window,
|
||||
if (old_adjustment == hadjustment)
|
||||
return;
|
||||
|
||||
g_signal_handlers_disconnect_by_func (old_adjustment,
|
||||
gtk_scrolled_window_adjustment_changed,
|
||||
scrolled_window);
|
||||
g_signal_handlers_disconnect_by_data (old_adjustment, scrolled_window);
|
||||
|
||||
gtk_adjustment_enable_animation (old_adjustment, NULL, 0);
|
||||
gtk_range_set_adjustment (GTK_RANGE (priv->hscrollbar), hadjustment);
|
||||
}
|
||||
|
||||
hadjustment = gtk_range_get_adjustment (GTK_RANGE (priv->hscrollbar));
|
||||
|
||||
g_signal_connect (hadjustment,
|
||||
"changed",
|
||||
G_CALLBACK (gtk_scrolled_window_adjustment_changed),
|
||||
@ -2272,6 +2274,7 @@ gtk_scrolled_window_set_hadjustment (GtkScrolledWindow *scrolled_window,
|
||||
"value-changed",
|
||||
G_CALLBACK (gtk_scrolled_window_adjustment_value_changed),
|
||||
scrolled_window);
|
||||
|
||||
gtk_scrolled_window_adjustment_changed (hadjustment, scrolled_window);
|
||||
gtk_scrolled_window_adjustment_value_changed (hadjustment, scrolled_window);
|
||||
|
||||
@ -2281,6 +2284,7 @@ gtk_scrolled_window_set_hadjustment (GtkScrolledWindow *scrolled_window,
|
||||
|
||||
if (gtk_widget_should_animate (GTK_WIDGET (scrolled_window)))
|
||||
gtk_adjustment_enable_animation (hadjustment, gtk_widget_get_frame_clock (GTK_WIDGET (scrolled_window)), ANIMATION_DURATION);
|
||||
|
||||
g_object_notify_by_pspec (G_OBJECT (scrolled_window), properties[PROP_HADJUSTMENT]);
|
||||
}
|
||||
|
||||
@ -2300,6 +2304,7 @@ gtk_scrolled_window_set_vadjustment (GtkScrolledWindow *scrolled_window,
|
||||
GtkWidget *child;
|
||||
|
||||
g_return_if_fail (GTK_IS_SCROLLED_WINDOW (scrolled_window));
|
||||
|
||||
if (vadjustment)
|
||||
g_return_if_fail (GTK_IS_ADJUSTMENT (vadjustment));
|
||||
else
|
||||
@ -2324,13 +2329,14 @@ gtk_scrolled_window_set_vadjustment (GtkScrolledWindow *scrolled_window,
|
||||
if (old_adjustment == vadjustment)
|
||||
return;
|
||||
|
||||
g_signal_handlers_disconnect_by_func (old_adjustment,
|
||||
gtk_scrolled_window_adjustment_changed,
|
||||
scrolled_window);
|
||||
g_signal_handlers_disconnect_by_data (old_adjustment, scrolled_window);
|
||||
|
||||
gtk_adjustment_enable_animation (old_adjustment, NULL, 0);
|
||||
gtk_range_set_adjustment (GTK_RANGE (priv->vscrollbar), vadjustment);
|
||||
}
|
||||
|
||||
vadjustment = gtk_range_get_adjustment (GTK_RANGE (priv->vscrollbar));
|
||||
|
||||
g_signal_connect (vadjustment,
|
||||
"changed",
|
||||
G_CALLBACK (gtk_scrolled_window_adjustment_changed),
|
||||
@ -2339,6 +2345,7 @@ gtk_scrolled_window_set_vadjustment (GtkScrolledWindow *scrolled_window,
|
||||
"value-changed",
|
||||
G_CALLBACK (gtk_scrolled_window_adjustment_value_changed),
|
||||
scrolled_window);
|
||||
|
||||
gtk_scrolled_window_adjustment_changed (vadjustment, scrolled_window);
|
||||
gtk_scrolled_window_adjustment_value_changed (vadjustment, scrolled_window);
|
||||
|
||||
@ -2759,17 +2766,22 @@ gtk_scrolled_window_destroy (GtkWidget *widget)
|
||||
|
||||
if (priv->hscrollbar)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (gtk_range_get_adjustment (GTK_RANGE (priv->hscrollbar)),
|
||||
gtk_scrolled_window_adjustment_changed,
|
||||
scrolled_window);
|
||||
GtkAdjustment *hadjustment = gtk_range_get_adjustment (GTK_RANGE (priv->hscrollbar));
|
||||
|
||||
g_signal_handlers_disconnect_by_data (hadjustment, scrolled_window);
|
||||
g_signal_handlers_disconnect_by_data (hadjustment, &priv->hindicator);
|
||||
|
||||
gtk_widget_unparent (priv->hscrollbar);
|
||||
priv->hscrollbar = NULL;
|
||||
}
|
||||
|
||||
if (priv->vscrollbar)
|
||||
{
|
||||
g_signal_handlers_disconnect_by_func (gtk_range_get_adjustment (GTK_RANGE (priv->vscrollbar)),
|
||||
gtk_scrolled_window_adjustment_changed,
|
||||
scrolled_window);
|
||||
GtkAdjustment *vadjustment = gtk_range_get_adjustment (GTK_RANGE (priv->vscrollbar));
|
||||
|
||||
g_signal_handlers_disconnect_by_data (vadjustment, scrolled_window);
|
||||
g_signal_handlers_disconnect_by_data (vadjustment, &priv->vindicator);
|
||||
|
||||
gtk_widget_unparent (priv->vscrollbar);
|
||||
priv->vscrollbar = NULL;
|
||||
}
|
||||
@ -4328,10 +4340,11 @@ remove_indicator (GtkScrolledWindow *scrolled_window,
|
||||
indicator->scrollbar = NULL;
|
||||
|
||||
context = gtk_widget_get_style_context (scrollbar);
|
||||
adjustment = gtk_range_get_adjustment (GTK_RANGE (scrollbar));
|
||||
|
||||
gtk_style_context_remove_class (context, "overlay-indicator");
|
||||
g_signal_handlers_disconnect_by_func (adjustment, indicator_value_changed, indicator);
|
||||
|
||||
adjustment = gtk_range_get_adjustment (GTK_RANGE (scrollbar));
|
||||
g_signal_handlers_disconnect_by_data (adjustment, indicator);
|
||||
|
||||
if (indicator->conceil_timer)
|
||||
{
|
||||
g_source_remove (indicator->conceil_timer);
|
||||
|
Loading…
Reference in New Issue
Block a user