From 92a17abc1b189188a80c38d44c00e32d291da82c Mon Sep 17 00:00:00 2001 From: =?utf8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Fri, 27 Apr 2007 08:48:56 +0000 Subject: [PATCH] added copy ctor to wxCStrData to fix crashes when passing to vararg functions git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45687 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/string.h | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/include/wx/string.h b/include/wx/string.h index 476af64419..226e6effec 100644 --- a/include/wx/string.h +++ b/include/wx/string.h @@ -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 ) -- 2.45.2