From 9bd5c5fcda3fe2222bf37f1615961516d6b40e7f Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 8 Jun 2012 18:44:14 +0000 Subject: [PATCH] Use wxString::Clone() instead of c_str() in wxThreadEvent copy ctor. Creating a new wxString from c_str() of the old one resulted in dropping all string data after the first embedded NUL. Fix this by using Clone() method that exists specifically for this purpose. It also makes the code more clear. Closes #14380. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71701 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + include/wx/event.h | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/changes.txt b/docs/changes.txt index e886f895b2..951e0af088 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -523,6 +523,7 @@ All: - Fix deadlock due to too many events in Unix console apps (Lukasz Michalski). - Added wxDir::GetNameWithSep(). - Allow unloading wxPluginLibrary objects in any order (manyleaves). +- Fix passing strings with embedded NULs in wxThreadEvents (sodev). All (GUI): diff --git a/include/wx/event.h b/include/wx/event.h index 8303647c39..283a0f56cd 100644 --- a/include/wx/event.h +++ b/include/wx/event.h @@ -1244,7 +1244,7 @@ public: { // make sure our string member (which uses COW, aka refcounting) is not // shared by other wxString instances: - SetString(GetString().c_str()); + SetString(GetString().Clone()); } virtual wxEvent *Clone() const