Fix crash in wxArray::insert() overload taking iterator range.

The iterator passed as argument could be invalidated by the function itself,
update it before using it.

Closes #13371.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68468 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2011-07-30 23:38:43 +00:00
parent e999b903ca
commit 9c5c5c9cfd
2 changed files with 4 additions and 0 deletions

View File

@@ -440,6 +440,7 @@ Major new features in this release
All:
- Fix parsing of negated long options in wxCmdLineParser (roed_bis).
- Fix crash in wxArray::insert() overload taking iterator range (wsu).
All (GUI):

View File

@@ -358,6 +358,9 @@ void name::insert(iterator it, const_iterator first, const_iterator last) \
return; \
Grow(nInsert); \
\
/* old iterator could have been invalidated by Grow(). */ \
it = begin() + nInsert; \
\
memmove(&m_pItems[nIndex + nInsert], &m_pItems[nIndex], \
(m_nCount - nIndex)*sizeof(T)); \
for (size_t i = 0; i < nInsert; ++i, ++it, ++first) \