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



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).

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.

Thanks,
Chuck







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