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 638929 - array elements lack correct is_pointer
array elements lack correct is_pointer
Status: RESOLVED FIXED
Product: gobject-introspection
Classification: Platform
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
Depends on:
Blocks: 638915
 
 
Reported: 2011-01-07 18:12 UTC by Tomeu Vizoso
Modified: 2015-02-07 16:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Preserve the c:type of array elements (11.40 KB, patch)
2011-01-20 15:36 UTC, Tomeu Vizoso
committed Details | Review

Description Tomeu Vizoso 2011-01-07 18:12:03 UTC
For arrays containing pointers, the gir lacks enough information for the compiler to know whether the elements are pointers or not.

For example:

          <array c:type="GVariant**">
            <type name="GLib.Variant"/>
          </array>

This produces an array containing GVariant instead of GVariant*

But this:

          <array c:type="GVariant**">
            <type name="GLib.Variant" c:type="GVariant*"/>
          </array>

Correctly compiles to a contained type with is_pointer == 1.

There's a patch for the tests that reproduces it in https://bugzilla.gnome.org/show_bug.cgi?id=638915
Comment 1 Mikkel Kamstrup Erlandsen 2011-01-20 14:49:34 UTC
I can confirm that adding c:type="GVariant*" makes this work for me as well
Comment 2 Tomeu Vizoso 2011-01-20 15:36:01 UTC
Created attachment 178844 [details] [review]
Preserve the c:type of array elements

So the element type has the correct is_pointer flag
Comment 3 Colin Walters 2011-01-20 18:47:23 UTC
Review of attachment 178844 [details] [review]:

One small change, then feel free to commit.

::: giscanner/maintransformer.py
@@ +327,3 @@
             element_type_node = node.type.clone()
+            # The element's ctype is the array's dereferenced
+            element_type_node.ctype = element_type_node.ctype[:-1]

I'd prefer a check here that the last character is actually a '*', like:

if element_type_node.ctype.endswith('*'):
  element_type_node.ctype = element_type_node.ctype[:-1]
Comment 4 Tomeu Vizoso 2011-01-21 09:48:07 UTC
Attachment 178844 [details] pushed as 751a9fa - Preserve the c:type of array elements
Comment 5 André Klapper 2015-02-07 16:50:05 UTC
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]