Re: Segmentation fault in GHashTable



On Fri, Jun 24, 2005 at 05:59:37PM +0200, Uzytkownik wrote:
I've problem with GHashTable:
(...)
self->private->check = g_hash_table_new(g_int_hash, g_int_equal);
g_hash_table_insert(self->private->check, GINT_TO_POINTER(3), "%%(.*)");
(...)

In unit test(I use check) it show:
(...)
check-plik.c:30:E:Core:funkcja: (after this point) Received signal 11
(Segmentation fault)

And I know that error is in seconde line.

What is wrong?

g_int_equal() and g_int_hash() take *pointers* to integers.
For direct integer keys you have to use g_direct_hash().

Yeti


--
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?



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