X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0f08aa44323c65b92cbef304c59b742af8fd717c..153107b4021fe0e6c3ad2ed510d3225f138eee83:/include/wx/list.h diff --git a/include/wx/list.h b/include/wx/list.h index a84ee041bb..78e86ee694 100644 --- a/include/wx/list.h +++ b/include/wx/list.h @@ -1010,11 +1010,22 @@ private: iterator insert(const iterator& it, const_reference v) \ { \ if ( it == end() ) \ + { \ Append((const_base_reference)v); \ + /* \ + note that this is the new end(), the old one was \ + invalidated by the Append() call, and this is why we \ + can't use the same code as in the normal case below \ + */ \ + iterator itins(end()); \ + return --itins; \ + } \ else \ + { \ Insert(it.m_node, (const_base_reference)v); \ - iterator itprev(it); \ - return itprev--; \ + iterator itins(it); \ + return --itins; \ + } \ } \ void insert(const iterator& it, size_type n, const_reference v) \ { \