public T steal_qdata<T> (Quark quark)

This function gets back user data pointers stored via g_object_set_qdata and removes the data from object without invoking its destroy function (if any was set).

Usually, calling this function is only required to update user data pointers with a destroy notifier, for example:

object_add_to_user_list (GObject *object,
const gchar *new_string)
// the quark, naming the object data
GQuark quark_string_list = g_quark_from_static_string ("my-string-list");
// retrive the old string list
GList *list = g_object_steal_qdata (object, quark_string_list);

// prepend new string
list = g_list_prepend (list, g_strdup (new_string));
// this changed 'list', so we need to set it again
g_object_set_qdata_full (object, quark_string_list, list, free_string_list);
static void
free_string_list (gpointer data)
GList *node, *list = data;

for (node = list; node; node = node->next)
g_free (node->data);
g_list_free (list);
Using get_qdata in the above example, instead of steal_qdata would have left the destroy function set, and thus the partial string list would have been freed upon set_qdata_full.



The GObject to get a stored user data pointer from


A Quark, naming the user data pointer


The user data pointer set, or null