Re: [Gimp-developer] Error when calling gimp_file_load() from concurrent thread
- From: Michael Natterer <mitch gimp org>
- To: Alessandro Francesconi <misterbirra hotmail it>
- Cc: gimp-developer-list gnome org
- Subject: Re: [Gimp-developer] Error when calling gimp_file_load() from concurrent thread
- Date: Sat, 14 Jul 2012 22:01:55 +0200
On Sat, 2012-07-14 at 21:15 +0200, Alessandro Francesconi wrote:
> Hello, I'm the author of BIMP, Batch Image Manipulation Plugin
> (http://www.alessandrofrancesconi.it/projects/bimp/) and I'm extending
> this tool with the possibility to stop the whole batch process by
> clicking on a GTK button.
>
> For that I'm enabling a multi threading functionality. In few words,
> when clicking on the "Apply" button, the function that does the batch
> process is called from a newly created thread, with the use of
> 'g_thread_new ("thread_name", bimp_start_batch, data)'.
>
> I'm facing a strange problem: everything that is called from the
> concurrent thread (precisely by 'bimp_start_batch' function) works,
> except when it's time to call 'gimp_file_load' for opening the image
> files... because the program crashes with this kind of message in the
> console:
>
> (bimp:6646): LibGimpBase-ERROR **: gimp_wire_read_msg: could not find
> handler for message: 1952804208
>
> Is it something related to the fact that gimp_file_load() tries to send
> a message but, having it been called from a secondary thread, the
> message "never reaches its destination"?
> Does the group of functions here
> http://developer.gimp.org/api/2.0/libgimp/libgimp-gimpmessage.html and
> here
> http://developer.gimp.org/api/2.0/libgimp/libgimp-gimpplugin.html#gimp-plugin-set-pdb-error-handler
> can help me?
>
> In other words, what's the correct way to call gimp_* functions from a
> concurrent thread? Thank you so much for your help.
You *must not* call GIMP API from anywhere but the main thread, and
you *should* not call GTK+ API from anything but the main thread,
or your stuff won't work on win32/osx.
You might find GIMP API that works multi-threaded, but definitely not
any that talk to the core via the PDB.
--mitch
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]