From 676b09e79803d11aa66784595b8c4fbabbe67a09 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Tue, 13 Sep 2005 13:33:01 +0000 Subject: [PATCH] Silently return NULL if the widget is not realized. (#316023, Guillaume 2005-09-13 Matthias Clasen * gtk/gtktreeview.c (gtk_tree_view_create_row_drag_icon): * gtk/gtkiconview.c (gtk_icon_view_create_drag_icon): Silently return NULL if the widget is not realized. (#316023, Guillaume Cottenceau) --- ChangeLog | 7 +++++++ ChangeLog.pre-2-10 | 7 +++++++ gtk/gtkiconview.c | 6 ++++++ gtk/gtktreeview.c | 10 ++++++++-- 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index db7628eb5c..8d8b7e5277 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-09-13 Matthias Clasen + + * gtk/gtktreeview.c (gtk_tree_view_create_row_drag_icon): + * gtk/gtkiconview.c (gtk_icon_view_create_drag_icon): Silently + return NULL if the widget is not realized. (#316023, + Guillaume Cottenceau) + 2005-09-11 Matthias Clasen * gdk/gdk.symbols: diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index db7628eb5c..8d8b7e5277 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,10 @@ +2005-09-13 Matthias Clasen + + * gtk/gtktreeview.c (gtk_tree_view_create_row_drag_icon): + * gtk/gtkiconview.c (gtk_icon_view_create_drag_icon): Silently + return NULL if the widget is not realized. (#316023, + Guillaume Cottenceau) + 2005-09-11 Matthias Clasen * gdk/gdk.symbols: diff --git a/gtk/gtkiconview.c b/gtk/gtkiconview.c index 1a68ba96fc..28cacfdf61 100644 --- a/gtk/gtkiconview.c +++ b/gtk/gtkiconview.c @@ -6658,8 +6658,14 @@ gtk_icon_view_create_drag_icon (GtkIconView *icon_view, gint index; GdkRectangle area; + g_return_val_if_fail (GTK_IS_ICON_VIEW (icon_view), NULL); + g_return_val_if_fail (path != NULL, NULL); + widget = GTK_WIDGET (icon_view); + if (!GTK_WIDGET_REALIZED (widget)) + return NULL; + index = gtk_tree_path_get_indices (path)[0]; for (l = icon_view->priv->items; l; l = l->next) diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index fb3fe4222e..50c8b52276 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -12190,8 +12190,8 @@ gtk_tree_view_get_dest_row_at_pos (GtkTreeView *tree_view, * @tree_view: a #GtkTreeView * @path: a #GtkTreePath in @tree_view * - * Creates a #GdkPixmap representation of the row at @path. This image is used - * for a drag icon. + * Creates a #GdkPixmap representation of the row at @path. + * This image is used for a drag icon. * * Return value: a newly-allocated pixmap of the drag icon. **/ @@ -12214,8 +12214,14 @@ gtk_tree_view_create_row_drag_icon (GtkTreeView *tree_view, gint bin_window_width; gboolean is_separator = FALSE; + g_return_val_if_fail (GTK_IS_TREE_VIEW (tree_view), NULL); + g_return_val_if_fail (path != NULL, NULL); + widget = GTK_WIDGET (tree_view); + if (!GTK_WIDGET_REALIZED (tree_view)) + return NULL; + depth = gtk_tree_path_get_depth (path); _gtk_tree_view_find_node (tree_view,