A model may be dissociated from a still existing control, don't crash if it
happens (notice that we still would crash in the native GTK version right now,
so this still remains to be fixed there).
See #14616.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72590
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
DestroyTree();
m_selection.Clear();
- SortPrepare();
- BuildTree( GetModel() );
+ if (GetModel())
+ {
+ SortPrepare();
+ BuildTree( GetModel() );
+ }
+ else
+ {
+ m_count = 0;
+ }
GetOwner()->InvalidateColBestWidths();
UpdateDisplay();
if (!wxDataViewCtrlBase::AssociateModel( model ))
return false;
- m_notifier = new wxGenericDataViewModelNotifier( m_clientArea );
-
- model->AddNotifier( m_notifier );
+ if (model)
+ {
+ m_notifier = new wxGenericDataViewModelNotifier( m_clientArea );
+ model->AddNotifier( m_notifier );
+ }
+ else if (m_notifier)
+ {
+ m_notifier->Cleared();
+ m_notifier = NULL;
+ }
m_clientArea->DestroyTree();
- m_clientArea->BuildTree(model);
+ if (model)
+ {
+ m_clientArea->BuildTree(model);
+ }
m_clientArea->UpdateDisplay();