[cairo-commit] goocanvas/src goocanvas.c,1.5,1.6
Damon Chaplin
commit at pdx.freedesktop.org
Tue Feb 13 05:25:15 PST 2007
Committed by: damon
Update of /cvs/cairo/goocanvas/src
In directory kemper:/tmp/cvs-serv32637/src
Modified Files:
goocanvas.c
Log Message:
2007-02-13 Damon Chaplin <damon at gnome.org>
* src/goocanvas.c (goo_canvas_size_allocate): only allocate the child
widgets if we are realized, otherwise it crashes.
Index: goocanvas.c
===================================================================
RCS file: /cvs/cairo/goocanvas/src/goocanvas.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- goocanvas.c 6 Feb 2007 00:08:07 -0000 1.5
+++ goocanvas.c 13 Feb 2007 13:25:09 -0000 1.6
@@ -483,6 +483,8 @@
{
cairo_t *cr;
+ g_return_val_if_fail (canvas->canvas_window != NULL, NULL);
+
cr = gdk_cairo_create (canvas->canvas_window);
/*cairo_set_antialias (cr, CAIRO_ANTIALIAS_NONE);*/
@@ -1232,18 +1234,20 @@
widget->allocation = *allocation;
- tmp_list = canvas->widget_items;
- while (tmp_list)
+ if (GTK_WIDGET_REALIZED (widget))
{
- GooCanvasWidget *witem = tmp_list->data;
- tmp_list = tmp_list->next;
+ /* We can only allocate our children when we are realized, since we
+ need a window to create a cairo_t which we use for layout. */
+ tmp_list = canvas->widget_items;
+ while (tmp_list)
+ {
+ GooCanvasWidget *witem = tmp_list->data;
+ tmp_list = tmp_list->next;
- if (witem->widget)
- goo_canvas_allocate_child_widget (canvas, witem);
- }
+ if (witem->widget)
+ goo_canvas_allocate_child_widget (canvas, witem);
+ }
- if (GTK_WIDGET_REALIZED (widget))
- {
gdk_window_move_resize (widget->window,
allocation->x, allocation->y,
allocation->width, allocation->height);
More information about the cairo-commit
mailing list