Re: Glib hash table - unkown key in table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sun, Mar 23, 2014 at 07:09:41PM +0100, Ervin Hegedüs wrote:
> int utype_inc(char udatakey[15], int udata) {
> ...
> g_hash_table_insert(datastore, udatakey, utype_rec_udatas);

This is certainly wrong.  The string key must exist during the lifetime
of the hash table, so stack storage won't do it.  You need to allocate
the string on the heap (or use GStringChunk, quarks or whatever).  Using
g_hash_table_new_full() and passing a free-function can take care of
clean up when the table is destroyed.

Regards,

Yeti

_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
https://mail.gnome.org/mailman/listinfo/gtk-list





[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux