]> git.saurik.com Git - wxWidgets.git/commitdiff
Don't make full copy of string in wxThreadEvent::Clone().
authorVáclav Slavík <vslavik@fastmail.fm>
Tue, 19 Jan 2010 13:01:33 +0000 (13:01 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Tue, 19 Jan 2010 13:01:33 +0000 (13:01 +0000)
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

include/wx/event.h

index 6c83cb17265bb5f5b335ce5b5aa0c8fc1d6e9333..225da47b423cdbb1a0a1c364d661dfed25587724 100644 (file)
@@ -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