Re: problem displaying rgb images on window



On Tue, 2006-08-15 at 13:59 +0200, Daniel Haude wrote:
On Wed, 26 Jul 2006 06:41:38 +0200, Richard Boaz <riboaz xs4all nl> wrote:

  gtk_widget_queue_draw_area(DrawingArea, 0, 0,
DrawingArea->allocation.width, DrawingArea->allocation.height);
  while (gtk_events_pending())
    gtk_main_iteration();
 }  // end while

What is the while loop for?

To process all pending events pending as pmap_expose needs the static
pixbuf "alive" and it's unref'ed at the end of this function. But it's
broken as the next expose event will get a pixbuf that may not exists as
dispMap is storing a pointer to a gobject that have been destroyed.

This scheme assumes that the expose event will only happen when you call
queue_draw, but any overlapping of other application's window over this
widget - among a myriad other causes - will need redraw to happen - thus
the expose-event signal will be raised.

You can get rid of this loop, and you must not destroy the pixbuf until
the widget is destroyed.
-- 
Iago Rubio




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