Use vector in wxMSW wxAcceleratorTable code
No real changes, just replace manually-allocated buffer with a vector.
This commit is contained in:
parent
d12c3d0805
commit
4cc13e1099
1 changed files with 4 additions and 3 deletions
|
|
@ -31,6 +31,8 @@
|
|||
#include "wx/msw/private.h"
|
||||
#include "wx/msw/private/keyboard.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
wxIMPLEMENT_DYNAMIC_CLASS(wxAcceleratorTable, wxObject);
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
|
@ -95,7 +97,7 @@ wxAcceleratorTable::wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]
|
|||
{
|
||||
m_refData = new wxAcceleratorRefData;
|
||||
|
||||
ACCEL* arr = new ACCEL[n];
|
||||
std::vector<ACCEL> arr(n);
|
||||
for ( int i = 0; i < n; i++ )
|
||||
{
|
||||
int flags = entries[i].GetFlags();
|
||||
|
|
@ -115,8 +117,7 @@ wxAcceleratorTable::wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]
|
|||
arr[i].cmd = (WORD)entries[i].GetCommand();
|
||||
}
|
||||
|
||||
M_ACCELDATA->m_hAccel = ::CreateAcceleratorTable(arr, n);
|
||||
delete[] arr;
|
||||
M_ACCELDATA->m_hAccel = ::CreateAcceleratorTable(&arr[0], n);
|
||||
|
||||
M_ACCELDATA->m_ok = (M_ACCELDATA->m_hAccel != 0);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue