New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
contrib/vapi: Fix vala bindings to correct ownership and API breaks #258
Conversation
|
Ah, so that's how you adjust the Vala metadata to incorporate preprocessor variables... |
|
No, your changes were wrong from the vala point-of-view. You literally reverted accepted and discussed introspection changes. (Vala relies on the internal memory-management of GPtrArray and the current state can lead to trouble when adding or removing elements from those lists) |
|
This is really confusing...
Which sort of makes sense, but in the same way AppStream owns the contents of that array and will free them, you technically only need to free the container, not the individual elements. And according to the documentation, "container" should be used in that case as transfer annotation. Is there a consensus on how GPtrArray etc. should be treated,m and if so can this be documented somewhere? (maybe on https://wiki.gnome.org/Projects/GObjectIntrospection/Annotations/ ?). In any case, I would really like to fix the introspection annotations in the code directly instead of working around this issue in the VAPI metadata (i.e. by reverting the patch that introduced the issue). I have no idea how other languages handle this case, but there must be some "right" way that's good for most of them. GPtrArrays aren't that rare afterall... |
You are filling up a new GPtrArray (with set free_function) with newly created AsCompont objects. So the returned container with its elements is completely owned by the receiver.
Yes, reverting your change would be proper solution. Note that with your change the gobject annotations even mismatch now with AsCache. If other languages are ignoring the fact that GPtrArray is not a stateless structure, they are doing it wrong. |
|
AsCache is private API, so it receives less attention with regards to annotations. |
|
@ximion Thank and done. On that regard, |
|
Yikes! Those weren't intended to be public. If those were in use, I may need to add some compatibility code to handle them (the new AsIssueSeverity is public API though). |
|
Looks good, thanks for looking into this issue! |
No description provided.