From: Vadim Zeitlin on
On Sun, 20 Apr 2008 16:46:20 +0200 mailinglists <mailinglists(a)hajo-kirchhoff.de> wrote:

m> > m> I am using AddPendingEvent to post a wxString object from one thread to
m> > m> another and was under the impression that this is a safe thing to do.
m> >
m> > No, it isn't. You need to use s.c_str() or something like this to ensure
m> > that the string is really copied when you use it with AddPendingEvent() and
m> > not just shared.
m> >
m> That will not work either. If I use s.c_str() and pass it to
m> AddPendingEvent, AddPendingEvent will still create a wxString from the
m> c_str() and then that string is shared between threads. The crash will
m> still occur, although more rarely (I've tried it).

Sorry, I don't understand why does it occur, maybe it's a different crash?
To be precise, I don't see where is the string created inside
AddPendingEvent() shared between threads?

Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/