mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-02 15:46:17 +01:00
d951db4236
Along the same lines as g_clear_object(), g_set_object() is a convenience function to update a GObject pointer, handling reference counting transparently and correctly. Specifically, it handles the case where a pointer is set to its current value. If handled naïvely, that could result in the object instance being finalised. In the following code, that happens when (my_obj == new_value) and the object has a single reference: g_clear_object (&my_obj); my_obj = g_object_ref (new_value); It also simplifies boilerplate code such as set_property() implementations, which are otherwise long and boring. Test cases included. https://bugzilla.gnome.org/show_bug.cgi?id=741589 |
||
---|---|---|
.. | ||
.gitignore | ||
binding.c | ||
boxed.c | ||
closure.c | ||
dynamictests.c | ||
enums.c | ||
ifaceproperties.c | ||
Makefile.am | ||
marshalers.list | ||
object.c | ||
param.c | ||
private.c | ||
properties.c | ||
qdata.c | ||
reference.c | ||
signals.c | ||
testcommon.h | ||
threadtests.c | ||
type.c | ||
valuearray.c |