Re: [Rhythmbox-devel] gnomevfs.async_xfer segfaulting



On Tue, 2006-08-01 at 21:04 -0700, Adam Zimmerman wrote:
> I'm trying to upgrade the purchase downloading code in my magnatune
> plugin to use gnomevfs.async_xfer like the rest of the code. When I run
> rhythmbox and try to purchase/download an album, after about 20kB are
> downloaded I get a message about multiple segfaults (now I seem to be
> getting the message "Xlib: unexpected async reply (sequence 0x124f9)!",
> though it still segfaults).
> 
> Here's the section of code and the backtrace. It doesn't seem to do much
> different from the catalog downloading/moving code, so I'm not sure if
> it's something I'm doing or something else.

progress_update_callback is called from one of GnomeVFS's worker
threads, and as such it doesn't hold the GDK when it's called. This
means you can't call any Gtk/Gdk functions safely.

One option would be to add "gtk.gdk.threads_enter()" at the start of the
callback, and "gtk.gdk.threads_leave()" at the end. A better option
(which is requires for some non-X systems, like Windows) would be not do
any work in the callback thread itself, but instead add an idle callback
(which runs in the main thread) which done what you want.


Cheers,

James "Doc" Livingston
-- 
SCSI is not magic. There are fundamental technical reasons why it is
necessary to sacrifice a young goat to your SCSI chain now and then.
    -- John Woods



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