After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 692844 - Incorrect (out) annotation on gtk_tree_drag_source_drag_data_get
Incorrect (out) annotation on gtk_tree_drag_source_drag_data_get
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Widget: GtkTreeView
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtktreeview-bugs
gtktreeview-bugs
: 690678 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2013-01-29 23:12 UTC by Torsten Schoenfeld
Modified: 2013-03-15 16:12 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
treednd: Remove (out) annotation from GtkSelectionData arg (957 bytes, patch)
2013-01-29 23:13 UTC, Torsten Schoenfeld
committed Details | Review

Description Torsten Schoenfeld 2013-01-29 23:12:58 UTC
As of 2fb1c064020c5db189285b1d5e8b8dcea8e9d09b, gtk_tree_drag_source_drag_data_get's GtkSelectionData argument is marked as (out).  I don't think that's correct, for two reasons:

a) GtkSelectionData is semi-private (it's declared in gtkselectionprivate.h), and thus gobject-introspection has no knowledge of its fields or its size.  There is thus no way for language bindings to allocate GtkSelectionData.

b) Even if it was possible for language bindings to allocate GtkSelectionData, a zeroed-out instance thus created would not be usable with gtk_tree_drag_source_drag_data_get.  As far as I can tell, you need to initialize its "target" member to the GdkAtom of "GTK_TREE_MODEL_ROW".  Language bindings have no way of knowing this, of course.
Comment 1 Torsten Schoenfeld 2013-01-29 23:13:27 UTC
Created attachment 234782 [details] [review]
treednd: Remove (out) annotation from GtkSelectionData arg
Comment 2 Simon Feltman 2013-01-29 23:50:35 UTC
This seems right as it really is an (in) argument which you can call methods on to modify? I don't know the internals but when I briefly looked at bug 690678 I actually suggested the argument needs to be marked as "inout" :)

Based on your comment and trying to create a SelectionData from Python, we just get a MemoryError exception. As long as Python is wrapping the incoming object as shared memory and not copying it, it seems like the attached patch will also fix bug 690678 and make it compatible with the pygtk bindings.
Comment 3 Pavel Holejsovsky 2013-01-30 06:01:37 UTC
I certainly agree with the patch, the only problem is that I cannot find commit 2fb1c064020c5db189285b1d5e8b8dcea8e9d09b in my freshly synced git repo, and even http://git.gnome.org/browse/gtk+/tree/gtk/gtktreednd.c#n133 shows that there is currently no (out) annotation present.  Although it is still early morning and I'm probably doing something stupid :-)
Comment 4 Pavel Holejsovsky 2013-01-30 06:17:53 UTC
Umm, yes, I did something stupid.  Of course, that commit does exist and is mine, and the patch is also correct.  I'm waking up slowly :-)

As for suggested (inout) annotation, I don't think that it would be correct here.  AFAIK (inout) would be appropriate only if argument signature would be 'GtkSelectionData  **selection_data' and function would have to look at the contents of *selection_data and upon return sets (allocates) new value to *selection_data
Comment 5 Pavel Holejsovsky 2013-01-30 06:21:28 UTC
Review of attachment 234782 [details] [review]:

Looks fine to me, thanks!
Comment 6 Simon Feltman 2013-01-30 08:15:44 UTC
*** Bug 690678 has been marked as a duplicate of this bug. ***
Comment 7 Torsten Schoenfeld 2013-01-31 20:37:25 UTC
Thanks for the reviews.  Committed.
Comment 8 Simon Schampijer 2013-03-15 16:12:06 UTC
Can this fix go onto the gtk+ 3.6 branch as well? It is another missing piece for the Sugar drag and drop functionality and the OLPC images are currently based on 3.6 for another while.