Creating threads within widget draw routines ..



Hi,
I am working on developing a custom gnome canvas item that displays
audio waveforms of a DV AVI file.  As can be expected, parsing audio
samples from a DV file can be I/O consuming, so I want to create a
separate thread to handle parsing the AVI file and updating the canvas
drawing, so that the rest of the GUI doesn't stall.  I am creating the
thread within the canvas item's draw routine, which is called whenever
the canvas item needs to be redrawn.  The draw routine takes the
GdkDrawable to draw to, along with the exposed region to redraw.  I am
trying to pass this GdkDrawable into the thread routine, along with
other needed info, and exiting the draw routine.  The thread reads and
processes the data from disk, updates an internal cache I maintain, then
attempts to draw the results onto the GdkDrawable.  Unfortunately I am
getting the following error:

Gdk-ERROR **: BadDrawable (invalid Pixmap or Window parameter)
  serial 23182 error_code 9 request_code 66 minor_code 0

Looks like the GdkDrawable passed into the draw routine is only
temporary and goes away after the draw routine completes.  Is there a
more reliable method of drawing the canvas item from within a thread?

Many thanks,
Jason



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