Commit 0480e129 authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen

Use g_list_nth_data() instead of g_list_nth()->data in multiple places to

2005-09-19  Matthias Clasen  <mclasen@redhat.com>

	* gtk/gtkiconview.c: Use g_list_nth_data() instead of g_list_nth()->data
	in multiple places to avoid segfaults if the index is out of range.
	(#316422, Guillaume Cottenceau)
parent 7e1f4b5e
2005-09-19 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkiconview.c: Use g_list_nth_data() instead of g_list_nth()->data
in multiple places to avoid segfaults if the index is out of range.
(#316422, Guillaume Cottenceau)
2005-09-18 Hans Breuer <hans@breuer.org>
* gtk/gtktrayicon-win32.c : now handling events by hard-coded
......
2005-09-19 Matthias Clasen <mclasen@redhat.com>
* gtk/gtkiconview.c: Use g_list_nth_data() instead of g_list_nth()->data
in multiple places to avoid segfaults if the index is out of range.
(#316422, Guillaume Cottenceau)
2005-09-18 Hans Breuer <hans@breuer.org>
* gtk/gtktrayicon-win32.c : now handling events by hard-coded
......
......@@ -1753,8 +1753,8 @@ gtk_icon_view_set_cursor (GtkIconView *icon_view,
gtk_icon_view_stop_editing (icon_view, TRUE);
if (gtk_tree_path_get_depth (path) == 1)
item = g_list_nth (icon_view->priv->items,
gtk_tree_path_get_indices(path)[0])->data;
item = g_list_nth_data (icon_view->priv->items,
gtk_tree_path_get_indices(path)[0]);
if (!item)
return;
......@@ -5072,8 +5072,8 @@ gtk_icon_view_unselect_path (GtkIconView *icon_view,
g_return_if_fail (icon_view->priv->model != NULL);
g_return_if_fail (path != NULL);
item = g_list_nth (icon_view->priv->items,
gtk_tree_path_get_indices(path)[0])->data;
item = g_list_nth_data (icon_view->priv->items,
gtk_tree_path_get_indices(path)[0]);
if (!item)
return;
......@@ -5205,8 +5205,8 @@ gtk_icon_view_path_is_selected (GtkIconView *icon_view,
g_return_val_if_fail (icon_view->priv->model != NULL, FALSE);
g_return_val_if_fail (path != NULL, FALSE);
item = g_list_nth (icon_view->priv->items,
gtk_tree_path_get_indices(path)[0])->data;
item = g_list_nth_data (icon_view->priv->items,
gtk_tree_path_get_indices(path)[0]);
if (!item)
return FALSE;
......@@ -8480,7 +8480,6 @@ gtk_icon_view_accessible_model_rows_reordered (GtkTreeModel *tree_model,
GtkIconView *icon_view;
GtkIconViewItemAccessible *item;
GList *items;
GList *tmp_list;
AtkObject *atk_obj;
atk_obj = gtk_widget_get_accessible (GTK_WIDGET (user_data));
......@@ -8489,14 +8488,12 @@ gtk_icon_view_accessible_model_rows_reordered (GtkTreeModel *tree_model,
priv = gtk_icon_view_accessible_get_priv (atk_obj);
items = priv->items;
tmp_list = NULL;
while (items)
{
info = items->data;
item = GTK_ICON_VIEW_ITEM_ACCESSIBLE (info->item);
info->index = new_order[info->index];
tmp_list = g_list_nth (icon_view->priv->items, info->index);
item->item = tmp_list->data;
item->item = g_list_nth_data (icon_view->priv->items, info->index);
items = items->next;
}
priv->items = g_list_sort (priv->items,
......@@ -8761,7 +8758,6 @@ gtk_icon_view_accessible_add_selection (AtkSelection *selection,
GtkWidget *widget;
GtkIconView *icon_view;
GtkIconViewItem *item;
GList *l;
widget = GTK_ACCESSIBLE (selection)->widget;
if (widget == NULL)
......@@ -8769,11 +8765,11 @@ gtk_icon_view_accessible_add_selection (AtkSelection *selection,
icon_view = GTK_ICON_VIEW (widget);
l = g_list_nth (icon_view->priv->items, i);
if (!l)
item = g_list_nth_data (icon_view->priv->items, i);
if (!item)
return FALSE;
item = l->data;
gtk_icon_view_select_item (icon_view, item);
return TRUE;
......@@ -8871,11 +8867,10 @@ gtk_icon_view_accessible_is_child_selected (AtkSelection *selection,
return FALSE;
icon_view = GTK_ICON_VIEW (widget);
l = g_list_nth (icon_view->priv->items, i);
if (!l)
return FALSE;
item = l->data;
item = g_list_nth_data (icon_view->priv->items, i);
if (!item)
return FALSE;
return item->selected;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment