Opened 3 months ago

Closed 8 weeks ago

Last modified 8 weeks ago

#16226 closed defect (fixed)

wxDataViewCustomRenderer memory leak wxOSX-Cocoa

Reported by: johnr Owned by: VZ
Priority: normal Milestone:
Component: wxOSX-Cocoa Version: dev-latest
Keywords: wxDataViewCustomRenderer memory leak wxOSX-Cocoa Cc:
Blocked By: Blocking:
Patch: yes

Description

Diff below is a fix for memory leak in wxDataViewCustomRenderer

Index: src/osx/cocoa/dataview.mm
===================================================================
--- src/osx/cocoa/dataview.mm	(revision 76432)
+++ src/osx/cocoa/dataview.mm	(working copy)
@@ -2751,7 +2751,9 @@
       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()

Attachments (1)

dvcColLeakFix.diff download (537 bytes) - added by johnr 3 months ago.

Download all attachments as: .zip

Change History (3)

Changed 3 months ago by johnr

comment:1 Changed 8 weeks ago by VZ

  • Owner set to VZ
  • Resolution set to fixed
  • Status changed from new to closed

In 76637:

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.

comment:2 Changed 8 weeks ago by VZ

In 76641:

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.

Note: See TracTickets for help on using tickets.