]> git.saurik.com Git - wxWidgets.git/commitdiff
added copy ctor to wxCStrData to fix crashes when passing to vararg functions
authorVáclav Slavík <vslavik@fastmail.fm>
Fri, 27 Apr 2007 08:48:56 +0000 (08:48 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Fri, 27 Apr 2007 08:48:56 +0000 (08:48 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45687 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/string.h

index 476af6441913699440a924cc0c8060e55ab7d2b0..226e6effecd5ab4a66b7338407bf604dc9a5bb13 100644 (file)
@@ -186,8 +186,9 @@ private:
 public:
     // Ctor constructs the object from char literal; they are needed to make
     // operator?: compile and they intentionally take char*, not const char*
-    wxCStrData(char *buf);
-    wxCStrData(wchar_t *buf);
+    inline wxCStrData(char *buf);
+    inline wxCStrData(wchar_t *buf);
+    inline wxCStrData(const wxCStrData& data);
 
     inline ~wxCStrData();
 
@@ -2649,6 +2650,13 @@ inline wxCStrData::wxCStrData(char *buf)
 inline wxCStrData::wxCStrData(wchar_t *buf)
     : m_str(new wxString(buf)), m_offset(0), m_owned(true) {}
 
+inline wxCStrData::wxCStrData(const wxCStrData& data)
+    : m_str(data.m_owned ? new wxString(*data.m_str) : data.m_str),
+      m_offset(data.m_offset),
+      m_owned(data.m_owned)
+{
+}
+
 inline wxCStrData::~wxCStrData()
 {
     if ( m_owned )