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.
This commit is contained in:
Kristian Rietveld 2011-11-20 18:51:14 +01:00
parent 64a38bdb82
commit a069ec662f

View File

@ -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);