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
This commit is contained in:
Vadim Zeitlin
2008-11-29 22:30:58 +00:00
parent 664e5ff93e
commit ceef3893cb

View File

@@ -39,6 +39,7 @@
#endif #endif
#include "wx/imaglist.h" #include "wx/imaglist.h"
#include "wx/vector.h"
#include "wx/msw/private.h" #include "wx/msw/private.h"
@@ -2908,11 +2909,14 @@ void wxListCtrl::OnPaint(wxPaintEvent& event)
dc.SetPen(pen); dc.SetPen(pen);
dc.SetBrush(*wxTRANSPARENT_BRUSH); dc.SetBrush(*wxTRANSPARENT_BRUSH);
int numCols = GetColumnCount(); const int numCols = GetColumnCount();
int* indexArray = new int[numCols]; wxVector<int> indexArray(numCols);
if ( !ListView_GetColumnOrderArray( GetHwnd(), numCols, indexArray) ) if ( !ListView_GetColumnOrderArray(GetHwnd(),
numCols,
&indexArray[0]) )
{ {
wxFAIL_MSG( _T("invalid column index array in OnPaint()") ); wxFAIL_MSG( _T("invalid column index array in OnPaint()") );
return;
} }
int x = itemRect.GetX(); int x = itemRect.GetX();
@@ -2923,8 +2927,6 @@ void wxListCtrl::OnPaint(wxPaintEvent& event)
dc.DrawLine(x-1, firstItemRect.GetY() - gap, dc.DrawLine(x-1, firstItemRect.GetY() - gap,
x-1, itemRect.GetBottom()); x-1, itemRect.GetBottom());
} }
delete indexArray;
} }
} }
} }