[Vala] Thread unsafe GObject?



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]