Re: TreeDragSource data_get location



Kevin Ryde wrote:
Actually, I think it's necessary to clear a newly created
GtkSelectionData struct to zeros too (something I didn't change).

Yeah, I think the current code is completely broken.

Program below gets a segv from the current code.  I think the "data"
pointer in a GtkSelectionData is a malloced block or NULL.
gtk_selection_data_set() does g_free() on the old before copying and
storing the new.

Dunno if anything special should be initialized in the other fields, I
couldn't find the actual code within gtk that does a normal call out to
a treesource *drag_data_get() interface func.

I found one instance in gtk/gtkdnd.c, gtk_drag_drop().  It does the following
to initialize the data:

      selection_data.selection = GDK_NONE;
      selection_data.target = pair->target;
      selection_data.data = NULL;
      selection_data.length = -1;

pair->target is a GdkAtom.

It's not obvious to me what the default for the target should be.  You chose
the atom for GTK_TREE_MODEL_ROW -- why?

Is there a way to automatically test this stuff?  Ross once wrote an attempt,
t/GtkTreeView-Dnd.t.  But it's not run by default since he saw no way to
synthesize the necessary events.

-- 
Bye,
-Torsten



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]