Fix minor memory leaks under OS X
Two wxDataFormat arrays are not deleted. Use a wxScopedArray to delete them after usage (not using delete[] in case the functions ever have multiple exit points which makes it easier to forget adding them).
This commit is contained in:
@@ -24,6 +24,7 @@
|
|||||||
|
|
||||||
#include "wx/mstream.h"
|
#include "wx/mstream.h"
|
||||||
#include "wx/metafile.h"
|
#include "wx/metafile.h"
|
||||||
|
#include "wx/scopedarray.h"
|
||||||
#include "wx/tokenzr.h"
|
#include "wx/tokenzr.h"
|
||||||
#include "wx/filename.h"
|
#include "wx/filename.h"
|
||||||
|
|
||||||
@@ -391,8 +392,8 @@ bool wxDataObject::GetFromPasteboard( void * pb )
|
|||||||
PasteboardRef pasteboard = (PasteboardRef) pb;
|
PasteboardRef pasteboard = (PasteboardRef) pb;
|
||||||
|
|
||||||
size_t formatcount = GetFormatCount(wxDataObject::Set);
|
size_t formatcount = GetFormatCount(wxDataObject::Set);
|
||||||
wxDataFormat *array = new wxDataFormat[ formatcount ];
|
wxScopedArray<wxDataFormat> array(formatcount);
|
||||||
GetAllFormats(array, wxDataObject::Set);
|
GetAllFormats(array.get(), wxDataObject::Set);
|
||||||
|
|
||||||
ItemCount itemCount = 0;
|
ItemCount itemCount = 0;
|
||||||
wxString filenamesPassed;
|
wxString filenamesPassed;
|
||||||
@@ -535,8 +536,8 @@ bool wxDataObject::HasDataInPasteboard( void * pb )
|
|||||||
{
|
{
|
||||||
PasteboardRef pasteboard = (PasteboardRef) pb;
|
PasteboardRef pasteboard = (PasteboardRef) pb;
|
||||||
size_t formatcount = GetFormatCount(wxDataObject::Set);
|
size_t formatcount = GetFormatCount(wxDataObject::Set);
|
||||||
wxDataFormat *array = new wxDataFormat[ formatcount ];
|
wxScopedArray<wxDataFormat> array(formatcount);
|
||||||
GetAllFormats(array, wxDataObject::Set);
|
GetAllFormats(array.get(), wxDataObject::Set);
|
||||||
ItemCount itemCount = 0;
|
ItemCount itemCount = 0;
|
||||||
bool hasData = false;
|
bool hasData = false;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user