Re: [gtk-list] Re: Colors and GDK, this the best way?




On Sun, 20 Sep 1998, Eric Harlow wrote:
>     gc = (GdkGC *) malloc (sizeof (GdkGC));
> 

OK, this is the problem I bet. You have to use gdk_gc_new() instead of
malloc - it's not just memory allocation, you also have to do some
initialization and so on.

Jon created GdkGC statically, undoubtedly thinking of our Gdk_GC C++
wrapper which calls gdk_gc_new automatically.

A side comment: in general you probably want to use g_malloc or g_new
instead of malloc, that lets you interoperate with Gtk more nicely.  Plus
it automatically checks for freeing 0 and the malloc return value.

Havoc




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