[Vala] Thread unsafe GObject?
- From: gerhard gruber documatrix com
- To: vala-list gnome org
- Subject: [Vala] Thread unsafe GObject?
- Date: Sun, 16 Jan 2011 10:09:37 UT
Hi!
I just used the HashTable-Function get_values in one of my programs and noticed, that the returned
List-Object becomes deleted at the end of the function where I am using it - that's ok - but the values also
become deleted / unreferenced.
I think that this is not ok, because the values do not get referenced by the get_values function.
One example:
void test(HashTable<...> hash)
{
/* At this point all values in hash have reference count 1 */
List<...> values = hash.get_values();
/* At this point all values in hash have still reference count 1 */
... CODE ...
/* At the end of the function the method __g_list_free_g_object_unref0 (hash); is called in the c code */
/* __g_list_free_g_object_unref0 unrefs all objects in values -> they have reference count 0 now and become
deleted */
}
Now my question - is my code wrong? Should I insert an unowned for the values-variable? Or is the API wrong?
Or is this an error in the GLib?
Gerhard
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]