From: Václav Slavík Date: Tue, 19 Jan 2010 13:01:33 +0000 (+0000) Subject: Don't make full copy of string in wxThreadEvent::Clone(). X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/f8a7dd5f4162313d76ae2e2df46740f3a9e49071 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 --- diff --git a/include/wx/event.h b/include/wx/event.h index 6c83cb1726..225da47b42 100644 --- a/include/wx/event.h +++ b/include/wx/event.h @@ -1207,12 +1207,7 @@ public: virtual wxEvent *Clone() const { - wxThreadEvent* ev = 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; + return new wxThreadEvent(*this); } // this is important to avoid that calling wxEventLoopBase::YieldFor thread events