X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/2b5f62a0b2db198609b45dec622a018dae37008e..dd91da4ed1e9d2ba5d3bc2fae64a8e4ea86b5d41:/src/univ/listbox.cpp diff --git a/src/univ/listbox.cpp b/src/univ/listbox.cpp index f0f783992a..7ae71b51fe 100644 --- a/src/univ/listbox.cpp +++ b/src/univ/listbox.cpp @@ -127,6 +127,8 @@ bool wxListBox::Create(wxWindow *parent, wxListBox::~wxListBox() { + // call this just to free the client data -- and avoid leaking memory + DoClear(); } // ---------------------------------------------------------------------------- @@ -272,7 +274,8 @@ void wxListBox::Clear() void wxListBox::Delete(int n) { - wxCHECK_RET( n < GetCount(), _T("invalid index in wxListBox::Delete") ); + wxCHECK_RET( n >= 0 && n < GetCount(), + _T("invalid index in wxListBox::Delete") ); // do it before removing the index as otherwise the last item will not be // refreshed (as GetCount() will be decremented)