a11y/ScrolledWin|IconView: Connect signals safely

Use g_signal_connect_data() instead of g_signal_connect_object()
to make sure the callback gets disconnected when the data object
is destroyed. This avoids problems in garbage-collected bindings.

https://bugzilla.gnome.org/show_bug.cgi?id=789215
This commit is contained in:
Juan Pablo Ugarte 2017-10-19 15:16:43 -03:00 committed by Daniel Boles
parent bef44a0c9d
commit bc2fad6842
2 changed files with 18 additions and 18 deletions

View File

@ -1226,18 +1226,18 @@ gtk_icon_view_accessible_connect_model_signals (GtkIconView *icon_view)
GObject *obj;
obj = G_OBJECT (icon_view->priv->model);
g_signal_connect_data (obj, "row-changed",
(GCallback) gtk_icon_view_accessible_model_row_changed,
icon_view, NULL, 0);
g_signal_connect_data (obj, "row-inserted",
(GCallback) gtk_icon_view_accessible_model_row_inserted,
icon_view, NULL, G_CONNECT_AFTER);
g_signal_connect_data (obj, "row-deleted",
(GCallback) gtk_icon_view_accessible_model_row_deleted,
icon_view, NULL, G_CONNECT_AFTER);
g_signal_connect_data (obj, "rows-reordered",
(GCallback) gtk_icon_view_accessible_model_rows_reordered,
icon_view, NULL, G_CONNECT_AFTER);
g_signal_connect_object (obj, "row-changed",
G_CALLBACK (gtk_icon_view_accessible_model_row_changed),
icon_view, 0);
g_signal_connect_object (obj, "row-inserted",
G_CALLBACK (gtk_icon_view_accessible_model_row_inserted),
icon_view, G_CONNECT_AFTER);
g_signal_connect_object (obj, "row-deleted",
G_CALLBACK (gtk_icon_view_accessible_model_row_deleted),
icon_view, G_CONNECT_AFTER);
g_signal_connect_object (obj, "rows-reordered",
G_CALLBACK (gtk_icon_view_accessible_model_rows_reordered),
icon_view, G_CONNECT_AFTER);
}
static void

View File

@ -92,12 +92,12 @@ gtk_scrolled_window_accessible_initialize (AtkObject *obj,
window = GTK_SCROLLED_WINDOW (data);
g_signal_connect_data (gtk_scrolled_window_get_hscrollbar (window), "notify::visible",
G_CALLBACK (visibility_changed),
obj, NULL, FALSE);
g_signal_connect_data (gtk_scrolled_window_get_vscrollbar (window), "notify::visible",
G_CALLBACK (visibility_changed),
obj, NULL, FALSE);
g_signal_connect_object (gtk_scrolled_window_get_hscrollbar (window), "notify::visible",
G_CALLBACK (visibility_changed),
obj, 0);
g_signal_connect_object (gtk_scrolled_window_get_vscrollbar (window), "notify::visible",
G_CALLBACK (visibility_changed),
obj, 0);
obj->role = ATK_ROLE_SCROLL_PANE;
}