wxArrayString::Alloc() shouldn't clear the array contents

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43203 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2006-11-08 18:52:43 +00:00
parent 4e8d95587c
commit 9129836e62
2 changed files with 16 additions and 6 deletions

View File

@@ -2191,13 +2191,16 @@ void wxArrayString::Alloc(size_t nSize)
{
// only if old buffer was not big enough
if ( nSize > m_nSize ) {
Free();
wxDELETEA(m_pItems);
m_pItems = new wxChar *[nSize];
wxChar **pNew = new wxChar *[nSize];
if ( !pNew )
return;
memcpy(pNew, m_pItems, m_nCount*sizeof(wxChar *));
delete [] m_pItems;
m_pItems = pNew;
m_nSize = nSize;
}
m_nCount = 0;
}
// minimizes the memory usage by freeing unused memory