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 739879 - Not handling (transfer full) arguments properly
Not handling (transfer full) arguments properly
Status: RESOLVED FIXED
Product: seed
Classification: Bindings
Component: libseed
git master
Other Linux
: Normal critical
: ---
Assigned To: seed-maint
seed-maint
Depends on:
Blocks:
 
 
Reported: 2014-11-10 13:09 UTC by Sebastian Dröge (slomo)
Modified: 2014-11-11 03:13 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
seed-types: Keep another reference around for seed when handling (transfer full) function arguments (5.58 KB, patch)
2014-11-10 13:09 UTC, Sebastian Dröge (slomo)
none Details | Review

Description Sebastian Dröge (slomo) 2014-11-10 13:09:05 UTC
See attached hackish patch (that also breaks the API) to handle (transfer full) arguments properly. Before seed did not get another reference, which would mean that the function and seed shared the only reference.

If that function now keeps the reference around a bit longer in some data structure, seed might decide to unref it... destroying the object and leaving some pointer pointing to some object that does not exist anymore. Which is exactly what happened to me.

Are there better ways to handle this in the current codebase without breaking the API?


The same problem seems to be there in other situations too, also in the other way around (transfer full return values or out parameters) and in general quite a few places where reference counting looks weird (most of them with a FIXME comment already). Is someone planning to work on these things?
Comment 1 Sebastian Dröge (slomo) 2014-11-10 13:09:59 UTC
Created attachment 290337 [details] [review]
seed-types: Keep another reference around for seed when handling (transfer full) function arguments
Comment 2 Alan Knowles 2014-11-11 03:13:18 UTC
I think this is the only way to handle it as well

the FIXME's are there, but no big plans to address them, as at present I'm working on other things.

I've committed this in 

Regards
Alan