]> git.saurik.com Git - wxWidgets.git/commitdiff
replace the mismatched new[]/delete (bug #10234) with a wxVector
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 29 Nov 2008 22:30:58 +0000 (22:30 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 29 Nov 2008 22:30:58 +0000 (22:30 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57032 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/listctrl.cpp

index 504899d2ee5aef071db9caaf1f9e9e158a2c317f..4e2c3de06887bd0b9828507e98c9804d0ab09897 100644 (file)
@@ -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<int> 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;
         }
     }
 }