diff --git a/src/generic/treectlg.cpp b/src/generic/treectlg.cpp index 92610cada4..9b53eb766a 100644 --- a/src/generic/treectlg.cpp +++ b/src/generic/treectlg.cpp @@ -1861,7 +1861,10 @@ void wxGenericTreeCtrl::SetImageList(wxImageList *imageList) m_imageListNormal = imageList; m_ownsImageListNormal = FALSE; m_dirty = TRUE; - CalculateLineHeight(); + // Don't do any drawing if we're setting the list to NULL, + // since we may be in the process of deleting the tree control. + if (imageList) + CalculateLineHeight(); } void wxGenericTreeCtrl::SetStateImageList(wxImageList *imageList)