Don't make full copy of string in wxThreadEvent::Clone().

It's enough to do it once to ensure thread-safety. Doing it twice (once
in copy ctor called by Clone(), once in Clone() itself) only wastes
time.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63186 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík 2010-01-19 13:01:33 +00:00
parent 477618ea0c
commit f8a7dd5f41

View File

@ -1207,12 +1207,7 @@ public:
virtual wxEvent *Clone() const virtual wxEvent *Clone() const
{ {
wxThreadEvent* ev = new wxThreadEvent(*this); return new wxThreadEvent(*this);
// make sure our string member (which uses COW, aka refcounting) is not
// shared by other wxString instances:
ev->SetString(GetString().c_str());
return ev;
} }
// this is important to avoid that calling wxEventLoopBase::YieldFor thread events // this is important to avoid that calling wxEventLoopBase::YieldFor thread events