From: Kristian Rietveld Date: Sun, 20 Nov 2011 17:51:14 +0000 (+0100) Subject: Bug 660554 - gtk_tree_view_drag_begin: assertion `path != NULL' failed X-Git-Url: http://pileus.org/git/?a=commitdiff_plain;h=a069ec662faed7d1f02f1666f8cffdacf242fd3a;p=~andy%2Fgtk Bug 660554 - gtk_tree_view_drag_begin: assertion `path != NULL' failed Turned assertion into silent return. This assertion is only hit when dragging from an empty tree view. In this case, gtk_tree_view_begin_drag() is triggered from gtkdnd.c and not from gtk_tree_view_maybe_begin_dragging_row(). We actually want to cancel the drag at this point, but that is not possible with the GTK+ API as far as I can see. The alternative is to not allowing the drag to start. This could be done by simply unsetting the tree view as drag source when it is empty and setting it as drag source again when rows are added. I didn't choose to go with this for now, since this will likely break third party code. --- diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index 3f32c8780..e31de47d2 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -7613,7 +7613,14 @@ gtk_tree_view_drag_begin (GtkWidget *widget, &cell_x, &cell_y); - g_return_if_fail (path != NULL); + /* If path is NULL, there's nothing we can drag. For now, we silently + * bail out. Actually, dragging should not be possible from an empty + * tree view, but there's no way we can cancel that from here. + * Automatically unsetting the tree view as drag source for empty models + * is something that would likely break other people's code ... + */ + if (!path) + return; row_pix = gtk_tree_view_create_row_drag_icon (tree_view, path);