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 639081 - gi-scanner: caller-allocates inference does not work for records ref'd by alias
gi-scanner: caller-allocates inference does not work for records ref'd by alias
Status: RESOLVED FIXED
Product: gobject-introspection
Classification: Platform
Component: general
unspecified
Other All
: Normal normal
: ---
Assigned To: gobject-introspection Maintainer(s)
gobject-introspection Maintainer(s)
Depends on:
Blocks:
 
 
Reported: 2011-01-09 17:22 UTC by Pavel Holejsovsky
Modified: 2015-02-07 16:50 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Resolve aliases when detecting records/unions. (4.38 KB, patch)
2011-01-09 17:23 UTC, Pavel Holejsovsky
reviewed Details | Review
Follow aliases to records when calculating caller-allocates attribute value (5.41 KB, patch)
2011-01-10 20:17 UTC, Pavel Holejsovsky
accepted-commit_now Details | Review

Description Pavel Holejsovsky 2011-01-09 17:22:09 UTC
Typically seen on GdkRectangle, which is actually typedef to cairo_rectangle_int_t.  Having API:

/**
 * foo:
 * @area: (out):
 */
void
foo (GdkRectangle *area);

yields .gir with 'area' argument marked as caller-allocates="0".
Comment 1 Pavel Holejsovsky 2011-01-09 17:23:12 UTC
Created attachment 177877 [details] [review]
Resolve aliases when detecting records/unions.
Comment 2 Colin Walters 2011-01-10 19:10:35 UTC
Review of attachment 177877 [details] [review]:

::: giscanner/maintransformer.py
@@ +506,3 @@
+                           and target.target.target_giname is not None):
+                        target = self._transformer.lookup_giname(
+                            target.target.target_giname)

This should go in a helper method somewhere; something on transformer?
Comment 3 Pavel Holejsovsky 2011-01-10 20:17:00 UTC
Created attachment 177961 [details] [review]
Follow aliases to records when calculating caller-allocates attribute value

Thanks for review.  Here's hopefully better patch, removes obsolete unused transformer.follow_aliases() and adds transformer.resolve_aliases() which works on typenodes instead of gi_names.  The rest of patch just uses this new method.
Comment 4 Colin Walters 2011-01-13 15:11:45 UTC
Review of attachment 177961 [details] [review]:

Looks fine.

::: tests/scanner/regress.c
@@ +2897,3 @@
+void regress_aliased_caller_alloc (RegressAliasedTestBoxed *boxed)
+{
+  boxed->priv = g_slice_new0(RegressTestBoxedPrivate);

Space between identifier and paren.

::: tests/scanner/regress.h
@@ +583,3 @@
+ * RegressAliasedTestBoxed:
+ *
+ * Typedef'd TestBoxed for some reasons.

I know other comments have "for some reason", but can you explicitly write here:

"Typedef TestBoxed to test caller-allocates correctness"
Comment 5 André Klapper 2015-02-07 16:50:47 UTC
[Mass-moving gobject-introspection tickets to its own Bugzilla product - see bug 708029. Mass-filter your bugmail for this message: introspection20150207 ]