Hi,
I'm writing an image viewer. In short, when it opens a image, it puts
a request in a queue, which will be read by another thread which will
load the image and then notify the GUI thread. It works on Windows,
but now I'm testing on Linux and it's not working.
The program freezes everytime I open an image. I found out that the
thread gets stuck in a "BitmapFromBuffer" call. The GUI thread gets
stuck too, but not inside my code.
Does anyone have any idea on what's going on? Is it safe to call
BitmapFromBuffer from non GUI threads?
Thanks
Conrado PLG wrote:
Does anyone have any idea on what's going on? Is it safe to call
BitmapFromBuffer from non GUI threads?
apparently not. IN general, wx.Bitmap manipulation is considered GUI, and thus not thread safe -- very little in wx is considered thread safe.
Could you do the actual call in the main thread , triggered by a wx.CallAfter or something?
-Chris
···
--
Christopher Barker, Ph.D.
Oceanographer
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
I see! I did that, and now it works. Thanks!
The strangest thing is that it worked on Windows all this time...
Multi-threaded programming can really be a headache...
Conrado
···
On Wed, Sep 10, 2008 at 02:49, Christopher Barker <Chris.Barker@noaa.gov> wrote:
apparently not. IN general, wx.Bitmap manipulation is considered GUI, and
thus not thread safe -- very little in wx is considered thread safe.
Could you do the actual call in the main thread , triggered by a
wx.CallAfter or something?
-Chris