The following testcase crashes 7.7 HEAD:
-----------
void handle_expose(GTK2.Widget widget, array events, int dummy) { int width = widget->allocation()->width; int height = widget->allocation()->height;
Image.Image image = Image.Image(width,height,0,255,0); GTK2.GdkPixmap pixmap = GTK2.GdkPixmap(image); widget->draw_pixmap(GTK2.GdkGC(widget), pixmap, 0, 0, 0, 0, width, height); }
int main(int argc, array(string) argv) { GTK2.Widget drawing_area; GTK2.setup_gtk(); GTK2.Widget window = GTK2.Window(GTK2.GTK_WINDOW_TOPLEVEL); window->set_default_size(300, 300); window->signal_connect("destroy", GTK2.main_quit); drawing_area = GTK2.DrawingArea(); window->add(drawing_area); drawing_area->signal_connect("expose-event", handle_expose); window->show_all();
GTK2.main(); }
-----------
The error lies in 7.7/src/post_modules/GTK2/source/common_draw.inc and the following patch fixes the problem for draw_pixmap():
=================================================================== RCS file: /cvs/Pike/7.7/src/post_modules/GTK2/source/common_draw.inc,v retrieving revision 1.6 diff -u -r1.6 common_draw.inc --- common_draw.inc 27 Feb 2006 12:23:15 -0000 1.6 +++ common_draw.inc 15 Mar 2006 08:46:02 -0000 @@ -144,7 +144,7 @@ get_all_args("draw_pixmap",args,"%o%o%+%+%+%+%i%i", &g,&p,&xs,&ys,&xd,&yd,&w,&h); if (w>0 && h>0) - gdk_draw_pixmap(TWIN,GC(g),GDK_DRAWABLE(p),xs,ys,xd,yd,w,h); + gdk_draw_pixmap(TWIN,GC(g),GDK_DRAWABLE(get_gdkobject(p, pixmap)),xs,ys,xd,yd,w,h); RETURN_THIS(); }
Some of the other draw_* in common_draw.inc do the same kind of strange casts from pike-objects to gtk-objects, so they should probably be looked at too.
pike-devel@lists.lysator.liu.se