Skip to content

gi: Support caller-allocates GValue arguments

Marco Trevisan requested to merge 3v1n0/gjs:gvalue-caller-allocates into master

When we were handling a GValue caller-allocates argument we actually were changing a new temporary GArgument copy that we actually didn't end up passing to the function that was changing it.

To ensure that this doesn't happen:

  • When a caller-allocates argument is passed to a function, use the actual GIArgument pointer and not deference it.
  • Include an argument flag that can be used at conversion time to make clear that we're working on the actual caller allocated argument and not in a gjs copy of it.
  • When converting a JSValue to GValue, act on the caller allocated (possibly by arg-cache) memory, instead of setting a new GValue.

As per this we can enable the vfunc_caller_allocated_out_parameter test now.

This doesn't seem enough to fix #74 (closed) testcase though as the gtk introspection doesn't give us enough information about being caller-allocated.


iwyu seems confused by a required include...

Merge request reports