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
This commit is contained in:
Václav Slavík
2007-04-27 08:48:56 +00:00
parent f3b757e41c
commit 92a17abc1b

View File

@@ -186,8 +186,9 @@ private:
public: public:
// Ctor constructs the object from char literal; they are needed to make // Ctor constructs the object from char literal; they are needed to make
// operator?: compile and they intentionally take char*, not const char* // operator?: compile and they intentionally take char*, not const char*
wxCStrData(char *buf); inline wxCStrData(char *buf);
wxCStrData(wchar_t *buf); inline wxCStrData(wchar_t *buf);
inline wxCStrData(const wxCStrData& data);
inline ~wxCStrData(); inline ~wxCStrData();
@@ -2649,6 +2650,13 @@ inline wxCStrData::wxCStrData(char *buf)
inline wxCStrData::wxCStrData(wchar_t *buf) inline wxCStrData::wxCStrData(wchar_t *buf)
: m_str(new wxString(buf)), m_offset(0), m_owned(true) {} : 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() inline wxCStrData::~wxCStrData()
{ {
if ( m_owned ) if ( m_owned )