[wx-dev] Re: wxString(s.c_str()) thread safety (was Re: wxString threadsafe)

Vadim Zeitlin vadim at wxwidgets.org
Sat May 3 06:55:09 PDT 2008


On Fri, 02 May 2008 11:46:23 -0500 Eric <crc1021 at myrealbox.com> wrote:

E> From what I've followed in this discussion (correct me if I'm mistaken),
E> the documented method of using wxEvtHandler::AddPendingEvent for sending
E> events to the main thread from a worker thread may be problematic if the
E> event contains a wxString because wxEvent.Clone() uses the copy ctor
E> which just does a references copy.

 Right.

E> For the short term (using the current wx library), if I derive from
E> wxCommandEvent and override Clone() to do deep copy on the wxString,
E> then I can use that event to safely send strings to the main thread,
E> correct?

 Yes.

 Regards,
VZ



More information about the wx-dev mailing list