Fix inserting an element of wxArrayString itself back into it.

Do the insertion/addition before deallocating the old memory to allow things
like array.Add(array[0]) to work correctly.

Closes #2290.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@76907 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-07-13 14:27:29 +00:00
parent 7da4930b12
commit 0de26e62a7
3 changed files with 28 additions and 10 deletions

View File

@@ -364,7 +364,10 @@ protected:
void Copy(const wxArrayString& src); // copies the contents of another array
private:
void Grow(size_t nIncrement = 0); // makes array bigger if needed
// Allocate the new buffer big enough to hold m_nCount + nIncrement items and
// return the pointer to the old buffer, which must be deleted by the caller
// (if the old buffer is big enough, just return NULL).
wxString *Grow(size_t nIncrement);
size_t m_nSize, // current size of the array
m_nCount; // current number of elements