From 021bd17d492ed0195dbedeba5d4db772d802edd7 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 10 May 2014 16:15:52 +0000 Subject: [PATCH] Fix crash in generic wxDataViewCtrl::AssociateModel(NULL). Don't use the possibly dangling pointer. Closes #16249. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@76491 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/generic/datavgen.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/generic/datavgen.cpp b/src/generic/datavgen.cpp index f9aef9760f..2101073494 100644 --- a/src/generic/datavgen.cpp +++ b/src/generic/datavgen.cpp @@ -4797,9 +4797,12 @@ bool wxDataViewCtrl::AssociateModel( wxDataViewModel *model ) m_notifier = new wxGenericDataViewModelNotifier( m_clientArea ); model->AddNotifier( m_notifier ); } - else if (m_notifier) + else { - m_notifier->Cleared(); + // Our previous notifier has either been already deleted when the + // previous model was DecRef()'d in the base class AssociateModel() or + // is not associated with us any more because if the model is still + // alive, it's not used by this control. m_notifier = NULL; }