X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d355d3fe69153840d740469eddacc3336da2b5ae..c1066cdf62de692cec3b61f68da35263aa17b1c0:/src/common/string.cpp?ds=inline diff --git a/src/common/string.cpp b/src/common/string.cpp index 407d143e3c..7e6e2270d7 100644 --- a/src/common/string.cpp +++ b/src/common/string.cpp @@ -1089,9 +1089,9 @@ wxArrayString::wxArrayString(const wxArrayString& src) // assignment operator wxArrayString& wxArrayString::operator=(const wxArrayString& src) { - Clear(); + if ( m_nSize > 0 ) + Clear(); - m_nSize = 0; if ( src.m_nCount > ARRAY_DEFAULT_INITIAL_SIZE ) Alloc(src.m_nCount); @@ -1133,7 +1133,7 @@ void wxArrayString::Grow() memcpy(pNew, m_pItems, m_nCount*sizeof(char *)); // delete old memory (but do not release the strings!) - DELETEA(m_pItems); + wxDELETEA(m_pItems); m_pItems = pNew; } @@ -1163,8 +1163,7 @@ void wxArrayString::Clear() m_nSize = m_nCount = 0; - DELETEA(m_pItems); - m_pItems = NULL; + wxDELETEA(m_pItems); } // dtor @@ -1172,7 +1171,7 @@ wxArrayString::~wxArrayString() { Free(); - DELETEA(m_pItems); + wxDELETEA(m_pItems); } // pre-allocates memory (frees the previous data!) @@ -1183,7 +1182,7 @@ void wxArrayString::Alloc(size_t nSize) // only if old buffer was not big enough if ( nSize > m_nSize ) { Free(); - DELETEA(m_pItems); + wxDELETEA(m_pItems); m_pItems = new char *[nSize]; m_nSize = nSize; }