From 4f3b27e89a5e0586b8121124569dd3d1e30a7520 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sun, 1 Jun 2014 16:22:14 +0000 Subject: [PATCH] Don't leak wxDataViewCtrl column objects in wxOSX/Cocoa. NSOutlineView addTableColumn method takes ownership of the column passed to it, so we must release it ourselves to avoid leaking it. Closes #16223. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@76636 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- docs/changes.txt | 1 + src/osx/cocoa/dataview.mm | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/docs/changes.txt b/docs/changes.txt index b69c42c9ec..3134bdbcac 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -677,6 +677,7 @@ wxOSX: - Implement support for wxGA_VERTICAL in wxGauge (themindiswatching). - Add support for wxEVT_COMBOBOX_DROPDOWN and wxEVT_COMBOBOX_CLOSEUP events to wxOSX/Cocoa (Igor Korot). +- Fix several memory leaks in wxDataViewCtrl (John Roberts). 3.0.0: (released 2013-11-11) diff --git a/src/osx/cocoa/dataview.mm b/src/osx/cocoa/dataview.mm index 708d5fc4ff..1f6ea86edc 100644 --- a/src/osx/cocoa/dataview.mm +++ b/src/osx/cocoa/dataview.mm @@ -2045,6 +2045,10 @@ bool wxCocoaDataViewControl::InsertColumn(unsigned int pos, wxDataViewColumn* co // specified position the column is first appended and - if necessary - // moved to its final position: [m_OutlineView addTableColumn:nativeColumn]; + + // it is owned, and kepy alive, by m_OutlineView now + [nativeColumn release]; + if (pos != static_cast([m_OutlineView numberOfColumns]-1)) [m_OutlineView moveColumn:[m_OutlineView numberOfColumns]-1 toColumn:pos];