From 7915eea7a676370638deca71fe5ef18d95d08284 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 18 Oct 2013 18:15:17 +0000 Subject: [PATCH] Fix ItemDeleted() call in wxTreeListModel. While it doesn't matter when exactly do we call it with the generic or GTK native implementations, under OS X we must update the internal model first and call this method afterwards because it refreshes the control contents immediately and so was calling back to the model and getting the pointer to the item about to be deleted, which resulted in a crash when this pointer was dereferences later. Closes #15575. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75044 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/treelist.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/generic/treelist.cpp b/src/generic/treelist.cpp index 4d249c2cb5..73fbe6c466 100644 --- a/src/generic/treelist.cpp +++ b/src/generic/treelist.cpp @@ -716,8 +716,6 @@ void wxTreeListModel::DeleteItem(Node* item) Node* const parent = item->GetParent(); - ItemDeleted(ToDVI(parent), ToDVI(item)); - Node* previous = parent->GetChild(); if ( previous == item ) { @@ -739,6 +737,8 @@ void wxTreeListModel::DeleteItem(Node* item) previous->DeleteNext(); } + + ItemDeleted(ToDVI(parent), ToDVI(item)); } void wxTreeListModel::DeleteAllItems()