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 789245 - g_settings_bind() not conforming to lifecycle specification
g_settings_bind() not conforming to lifecycle specification
Status: RESOLVED FIXED
Product: glib
Classification: Platform
Component: gsettings
2.54.x
Other All
: Normal normal
: ---
Assigned To: Allison Karlitskaya (desrt)
gtkdev
Depends on:
Blocks:
 
 
Reported: 2017-10-20 12:24 UTC by Xiang Fan
Modified: 2017-10-23 11:20 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
0001-gsettings-make-g_settings_bind-documentation-clearer.patch (1.89 KB, patch)
2017-10-20 13:22 UTC, Xiang Fan
committed Details | Review

Description Xiang Fan 2017-10-20 12:24:26 UTC
Hi,

The reference says "note that the lifecycle of the binding is tied to the object" for g_settings_bind(), but in the code the binding seems to have a reference to settings, preventing it from being destroyed:

https://git.gnome.org/browse/glib/tree/gio/gsettings.c?id=9814898df6a2ea3006d5cbb457bd8419d8e815d4#n2853
https://git.gnome.org/browse/glib/tree/gio/gsettings.c?id=9814898df6a2ea3006d5cbb457bd8419d8e815d4#n3072

Thanks.
Comment 1 Emmanuele Bassi (:ebassi) 2017-10-20 12:28:17 UTC
The "object" to which it's referring to is the object you pass to g_settings_bind(), not the GSettings instance.

Once the object goes away, the reference acquired on the GSettings instance is also released.

We could modify the documentation to use `@object`; this way it would be a bit clearer to which object instance we're referring to.
Comment 2 Xiang Fan 2017-10-20 13:22:37 UTC
Created attachment 361944 [details] [review]
0001-gsettings-make-g_settings_bind-documentation-clearer.patch
Comment 3 Emmanuele Bassi (:ebassi) 2017-10-20 13:23:40 UTC
Review of attachment 361944 [details] [review]:

Looks good, thanks!
Comment 4 Xiang Fan 2017-10-20 13:27:24 UTC
(In reply to Emmanuele Bassi (:ebassi) from comment #3)
> Review of attachment 361944 [details] [review] [review]:
> 
> Looks good, thanks!

Can you please push it as I don't have the commit rights?
Comment 5 Philip Withnall 2017-10-23 11:20:32 UTC
Pushed, thanks for the patch.