// 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);
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;
}
m_nSize =
m_nCount = 0;
- DELETEA(m_pItems);
- m_pItems = NULL;
+ wxDELETEA(m_pItems);
}
// dtor
{
Free();
- DELETEA(m_pItems);
+ wxDELETEA(m_pItems);
}
// pre-allocates memory (frees the previous data!)
// 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;
}