RE: [gtk-list] Problems with GHashTable
- From: Trog <trog gtk org>
- To: gtk-list redhat com
- Subject: RE: [gtk-list] Problems with GHashTable
- Date: Mon, 14 Dec 1998 17:47:17 -0000 (GMT)
On 13-Dec-98 tile@primenet.com wrote:
> After initializing a GHashTable variable, I try to insert a
> key/value pair
> which are gchar pointers using g_hash_insert (). It seems to
> insert fine, but
> when I try to look the value up using _hash_lookup (), I get NULL.
> I tried
> g_strdup'ing the pointers; it still doesn't work. It _does_ work
> when I put in
> constant strings. Can anyone explain why this happens and how I
> can fix it?
>
> I'm using glib 1.1.6 and gtk+ 1.1.6. Any help would be greatly
> appreciated.
>
First, upgrade to 1.1.7 - 1.1.6 has a nasty bug in it.
The hash table doesn't copy either the key or the value, so you must
keep them valid for the life of the hash table.
-tony
PS. not my design decision.
---
E-Mail: trog@gtk.org
Any two philosophers can tell each other all they know in two hours.
-- Oliver Wendell Holmes, Jr.
Go Bezerk! http://www.gtk.org/~trog
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]