From ceef3893cb12d80e679d4b619fb086529a36c2a8 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 29 Nov 2008 22:30:58 +0000 Subject: [PATCH] replace the mismatched new[]/delete (bug #10234) with a wxVector git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57032 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/listctrl.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/msw/listctrl.cpp b/src/msw/listctrl.cpp index 504899d2ee..4e2c3de068 100644 --- a/src/msw/listctrl.cpp +++ b/src/msw/listctrl.cpp @@ -39,6 +39,7 @@ #endif #include "wx/imaglist.h" +#include "wx/vector.h" #include "wx/msw/private.h" @@ -2908,11 +2909,14 @@ void wxListCtrl::OnPaint(wxPaintEvent& event) dc.SetPen(pen); dc.SetBrush(*wxTRANSPARENT_BRUSH); - int numCols = GetColumnCount(); - int* indexArray = new int[numCols]; - if ( !ListView_GetColumnOrderArray( GetHwnd(), numCols, indexArray) ) + const int numCols = GetColumnCount(); + wxVector indexArray(numCols); + if ( !ListView_GetColumnOrderArray(GetHwnd(), + numCols, + &indexArray[0]) ) { wxFAIL_MSG( _T("invalid column index array in OnPaint()") ); + return; } int x = itemRect.GetX(); @@ -2923,8 +2927,6 @@ void wxListCtrl::OnPaint(wxPaintEvent& event) dc.DrawLine(x-1, firstItemRect.GetY() - gap, x-1, itemRect.GetBottom()); } - - delete indexArray; } } } -- 2.45.2