From 22f0aa4c3ee59127e0a96b28cba11768497c35bc Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 1 Jun 2014 16:22:18 +0000 Subject: [PATCH] Fix memory leak when using custom renderers in wxOSX wxDataViewCtrl. wxDataViewRendererNativeData retains a reference to the cell passed to it, so the cell must be released after passing it to wxDataViewRendererNativeData to avoid leaking it. Closes #16226. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@76637 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/osx/cocoa/dataview.mm | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/osx/cocoa/dataview.mm b/src/osx/cocoa/dataview.mm index 1f6ea86edc..844036b7ef 100644 --- a/src/osx/cocoa/dataview.mm +++ b/src/osx/cocoa/dataview.mm @@ -2755,7 +2755,9 @@ wxDataViewCustomRenderer::wxDataViewCustomRenderer(const wxString& varianttype, m_editorCtrlPtr(NULL), m_DCPtr(NULL) { - SetNativeData(new wxDataViewRendererNativeData([[wxCustomCell alloc] init])); + wxCustomCell* cell = [[wxCustomCell alloc] init]; + SetNativeData(new wxDataViewRendererNativeData(cell)); + [cell release]; } bool wxDataViewCustomRenderer::MacRender()