Re: Problems with 1.2.9 gdk_rgb [was Re: Gtk (cvs HEAD) -> gdk_pixbuf does'nt compile correcly.]



Chuck Mason <chuckjr unbounded com> writes:

> I've been forgetting to post this, and it's doing me no good just
> knowing this fact so I might as well tell everyone.
> 
> A couple days ago I was writing a simple program: I created the
> interface in glade, and the main window had a menu, a GtkDrawingArea and
> that was it. I added a expose_event to the DrawingArea and used this
> code in that function:
>  
> void
> on_my_drawingarea_expose_event (GtkDrawingArea *da, gpointer data)
> {
>  
>     guchar *buffer = (guchar *) g_malloc (da->allocation.width *
>     da->allocation.height * 3);
>  
>     memset ((void *)buffer, 0x7f, da->allocation.width *
>     da->allocation.height * 3);
> 
>     gdk_rgb_draw_image (da->window, da->style->fg_gc[GTK_STATE_NORMAL],
>         0, 0, da->allocation.width, da->allocation.width,
>         GDK_RGB_DITHER_NORMAL, buffer,
>         da->allocation.width * 3);
> 
>     g_free (buffer);
> 
>     return;
> 
> }
> 
>  
> .. And it segfaulted. This could mean (at first glance) a problem with
> my code. I spent HOURS trying to determine what was wrong, so I asked a
> friend to try the program (who was using the same version Gtk+ etc. at
> that time), and it worked! Why? 
>  
> Two days ago, I got bored with my Gnome settings so I got a new theme
> for my sawfish manager and gtk+ interface, and then decided to go back
> to my program to see if I could figure out what was wrong. It ran. What
> a surprise.  I was confused at first, but I finally decided I would
> point my finger at the gdk theme engine (Not sure what you gtk-dev'ers
> call it officially).

GTK+ theme engine.
 
> So, now this means one of 2 things: 1) I wrote some bad code, or 2)
> something is seriously broken in the gdk engine.
> 
> I would like some feedback if anyone has anything to say about this.

There could be a thousand things going on here, probably having
nothing to do with GTK+ (though it could be). But without knowing
which theme engine, and having a complete compileable example which
reproduces the problem, who knows.

If I had to guess, I'd guess you forgot to call gdk_rgb_init() and
your second theme engine happened to call gdk_rgb_init() for you.

Regards,
                                       Owen




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