From: Stefan Csomor Date: Sun, 4 May 2008 13:55:14 +0000 (+0000) Subject: fixing memory leaks on three levels (bug report 1905138) X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/2b3bddf68b97d4b2a70f402772838a92abd60565?hp=e388dc214c74a5ac2d3c4d5f810fcfbd5f7fa01a fixing memory leaks on three levels (bug report 1905138) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53448 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/mac/carbon/listctrl_mac.cpp b/src/mac/carbon/listctrl_mac.cpp index 337bbaa8e8..13a20ac220 100644 --- a/src/mac/carbon/listctrl_mac.cpp +++ b/src/mac/carbon/listctrl_mac.cpp @@ -771,6 +771,8 @@ wxListCtrl::~wxListCtrl() delete m_imageListState; delete m_renameTimer; + + WX_CLEAR_LIST(wxColumnList, m_colsInfo); } /*static*/ @@ -2418,6 +2420,7 @@ void wxListCtrl::SetFocus() wxMacListCtrlItem::~wxMacListCtrlItem() { + WX_CLEAR_HASH_MAP( wxListItemList, m_rowItems ); } void wxMacListCtrlItem::Notification(wxMacDataItemBrowserControl *owner , @@ -2997,18 +3000,27 @@ OSStatus wxMacDataBrowserListCtrlControl::GetSetItemData(DataBrowserItemID itemI void wxMacDataBrowserListCtrlControl::ItemNotification(DataBrowserItemID itemID, DataBrowserItemNotification message, - DataBrowserItemDataRef WXUNUSED(itemData) ) + DataBrowserItemDataRef itemData ) { + wxMacListCtrlItem *item = NULL; + if ( !m_isVirtual ) + { + item = (wxMacListCtrlItem *) itemID; + } + // we want to depend on as little as possible to make sure tear-down of controls is safe - if ( message == kDataBrowserItemRemoved) + if ( message == kDataBrowserItemRemoved ) { - // make sure MacDelete does the proper teardown. + if ( item ) + item->Notification(this, message, itemData); return; } else if ( message == kDataBrowserItemAdded ) { // we don't issue events on adding, the item is not really stored in the list yet, so we // avoid asserts by getting out now + if ( item ) + item->Notification(this, message, itemData); return ; }