Generate methods with untyped records as container-transfer return values#1328
Draft
ousnius wants to merge 2 commits intogircore:mainfrom
Draft
Generate methods with untyped records as container-transfer return values#1328ousnius wants to merge 2 commits intogircore:mainfrom
ousnius wants to merge 2 commits intogircore:mainfrom
Conversation
Member
|
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>
|
…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. Example: gdk_pixbuf_get_formats
4e36f15 to
3cbe3a2
Compare
Member
|
These untyped records exist: |
Member
|
badcel
reviewed
Feb 25, 2026
| { | ||
| { Transfer: Transfer.Full } => Model.TypedRecord.GetFullyQuallifiedOwnedHandle(type), | ||
| { Transfer: Transfer.None } => Model.TypedRecord.GetFullyQuallifiedUnownedHandle(type), | ||
| { Transfer: Transfer.Container } => Model.TypedRecord.GetFullyQuallifiedOwnedHandle(type), |
Member
There was a problem hiding this comment.
You found a small bug here: this uses the TypedRecord model inside the UntypedRecord parameter converter.
I think in the end at runtime there is no difference as currently both kinds are named the same.
But it's not correct as the naming could change one day.
Can you fix this in a separate PR?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.