From 672c426cdfb369a965eee5eb946e59cfb8a86057 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 7 Feb 2009 23:37:13 +0000 Subject: [PATCH] fix insert(end()) [backport of r56299] git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@58741 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/list.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/wx/list.h b/include/wx/list.h index d10177f700..9ee125c524 100644 --- a/include/wx/list.h +++ b/include/wx/list.h @@ -1035,8 +1035,12 @@ private: } \ iterator insert(const iterator& it, const_reference v = value_type())\ { \ - Insert(it.m_node, (const_base_reference)v); \ - return iterator(it.m_node->GetPrevious(), GetLast()); \ + if ( it == end() ) \ + Append((const_base_reference)v); \ + else \ + Insert(it.m_node, (const_base_reference)v); \ + iterator itprev(it); \ + return itprev--; \ } \ void insert(const iterator& it, size_type n, const_reference v = value_type())\ { \