Generate methods with untyped records as container-transfer return values - #1328
Generate methods with untyped records as container-transfer return values#1328ousnius wants to merge 1 commit into
Conversation
|
The generated xml looks like this: <function name="returns_transfer_container"
c:identifier="girtest_untyped_record_tester_returns_transfer_container"
introspectable="0">
<source-position filename="girtest-untyped-record-tester.h" line="40"/>
<return-value>
<type name="UntypedRecordContainerTester"
c:type="GirTestUntypedRecordContainerTester*"/>
</return-value>
</function>
If you want to see if scenarios similar to As
<return-value transfer-ownership="container">
<doc xml:space="preserve"
filename="gdk-pixbuf/gdk-pixbuf-io.c"
line="3432">A list of
support image formats.</doc>
<type name="GLib.SList" c:type="GSList*">
<type name="PixbufFormat"/>
</type>
</return-value>
|
4e36f15 to
3cbe3a2
Compare
|
These untyped records exist: |
|
|
@badcel I committed a change to the tests that should now test what this PR is for (typed record).
Done: #1572 About your other comments, I think that can be done later and isn't a blocker for this PR.
The copy is a shallow byte copy:
Container release leaks non-head nodes. |
…lues transfer-container is usually used with GLib.List and GLib.SList as return values. The ownership of the returned container is transferred, but the ownership of the elements in the container is not. Tested via a static method mirroring gdk_pixbuf_get_formats: it returns a GSList with transfer-container containing two static typed record elements that are owned by native code. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
8d880c0 to
9b9c4b2
Compare
|
Should wait for #1573 because it allows manual handling for untyped records. |
transfer-containeris usually used withGLib.ListandGLib.SListas return values.The ownership of the returned container is transferred, but the ownership of the elements in the container is not.
API examples:
gdk_pixbuf_get_formatsgtk_textiter_get_tagsAdded a test that returns a container with two static elements that are owned by native code.