Ubuntu

Gtk-3.0.gir: TreeModel.get_iter argument iter should be direction:inout

Reported by Rumpeltux on 2012-07-13
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
GTK+
Expired
Medium
gtk+3.0 (Ubuntu)
Undecided
Unassigned

Bug Description

Same for Gtk-2.0.gir

The get_iter method is overriden by models to return a custom iter. The GtkTreeIter is initialised by the caller and passed to the callee who will fill in the user_data attribute.
Since the direction is set to "out", the param cannot be passed to the callee (e.g. using pygobject).
This makes it impossible to implement custom TreeModels with pygobject.
A fix will be to change the direction to "in" so that the argument gets passed to the callee ("inout" seems not to work :/).

      <field name="get_iter">
        <callback name="get_iter">
          <return-value transfer-ownership="none">
            <doc xml:whitespace="preserve">%TRUE, if @iter was set</doc>
            <type name="gboolean" c:type="gboolean"/>
          </return-value>
          <parameters>
            <parameter name="tree_model" transfer-ownership="none">
              <type name="TreeModel" c:type="GtkTreeModel*"/>
            </parameter>
            <parameter name="iter"
                       direction="in"
                       caller-allocates="1"
                       transfer-ownership="none">
              <doc xml:whitespace="preserve">the uninitialized #GtkTreeIter</doc>
              <type name="TreeIter" c:type="GtkTreeIter*"/>
            </parameter>
            <parameter name="path" transfer-ownership="none">
              <doc xml:whitespace="preserve">the #GtkTreePath</doc>
              <type name="TreePath" c:type="GtkTreePath*"/>
            </parameter>
          </parameters>
        </callback>
      </field>

As a sidenote: What I do not understand though is how the handling of the return value happens. Apparently a tuple is expected with the first argument being the boolean return value and the second argument seems to be copied to the iter->stamp field (the first field of the struct). However, it does not seem possible to set the other struct's fields.

When returning anything else than a tuple, the following error is raised (which is ok though, because the calling convention requires to return a tuple there):
ERROR:/build/buildd/pygobject-3.2.2/gi/pygi-closure.c:317:_pygi_closure_set_out_arguments: code should not be reached

Rumpeltux (rumpeltux) on 2012-07-16
description: updated
Changed in gtk:
importance: Unknown → Medium
status: Unknown → New
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in gtk+3.0 (Ubuntu):
status: New → Confirmed
Changed in gtk:
status: New → Expired
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.