AddPendingEvent between threads crashes on Mac

Robert Roebling robert at roebling.de
Fri Jun 1 23:48:37 PDT 2007


Joost wrote:
> Robert Roebling wrote:
> > Did you have a look at src/mac/carbon/utils.cpp, wxMacWakeUp()?
> > There is a comment about a race condition there (in my version
> > of that file). What version of wx are you using?
> 
> Hi Robert,
> 
> Thanks for your replies. I just took a look. I'm using 2.8.4. The part 
> with the race condition comment is commented out (#if 0).
> 
> If I understand it correctly, the first alternative (which is commented 
> out) checks whether a wakeupevent is already in the queue, and only 
> posts it if it isn't there yet. I do understand your remark regarding 
> the race condition. The second alternative simply always posts a wakeup 
> event. And that second alternative is used, I don't see anything wrong 
> in it.
> 
> Looking at the crash logs, to me it really looks like a clash between 
> PostEventToQueue and RemoveEventFromQueue. It has happened with a user 
> on a ppc machine, and I can reproduce the problem on my intel machine 
> (latest OSX updates installed).

How about testing what is wrong by adding a wxMutex to PostEventQueue
and RemoveEventFromQueue. This will probably block for a short while,
but won't crash.

  Robert






More information about the wx-users mailing list