From c1fae0d0ee4122b96a83c6e3bdd4f2ade9e71698 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 6 Mar 2010 00:31:04 +0000 Subject: [PATCH] Don't store header height in generic wxListCtrl member variable. This is simply unnecessary and resulted in a crash in wxDFB because the window was used for this variable initialization before being created. Closes #11711. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63638 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/generic/listctrl.h | 1 - src/generic/listctrl.cpp | 11 +++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/include/wx/generic/listctrl.h b/include/wx/generic/listctrl.h index 1d02db3389..591fb664aa 100644 --- a/include/wx/generic/listctrl.h +++ b/include/wx/generic/listctrl.h @@ -212,7 +212,6 @@ public: m_ownsImageListState; wxListHeaderWindow *m_headerWin; wxListMainWindow *m_mainWin; - wxCoord m_headerHeight; protected: virtual bool DoPopupMenu( wxMenu *menu, int x, int y ); diff --git a/src/generic/listctrl.cpp b/src/generic/listctrl.cpp index 951768cae0..d42d0c43bb 100644 --- a/src/generic/listctrl.cpp +++ b/src/generic/listctrl.cpp @@ -4272,7 +4272,6 @@ void wxGenericListCtrl::Init() m_mainWin = NULL; m_headerWin = NULL; - m_headerHeight = wxRendererNative::Get().GetHeaderButtonHeight(this); } wxGenericListCtrl::~wxGenericListCtrl() @@ -4299,7 +4298,11 @@ void wxGenericListCtrl::CreateOrDestroyHeaderWindowAsNeeded() ( this, wxID_ANY, m_mainWin, wxPoint(0,0), - wxSize(GetClientSize().x, m_headerHeight), + wxSize + ( + GetClientSize().x, + wxRendererNative::Get().GetHeaderButtonHeight(this) + ), wxTAB_TRAVERSAL ); @@ -4313,7 +4316,7 @@ void wxGenericListCtrl::CreateOrDestroyHeaderWindowAsNeeded() #ifdef __WXOSX__ // TODO not tested under other platforms, remove the platform condition if // it works on those as well - GetSizer()->SetItemMinSize( m_headerWin, wxSize(-1,m_headerHeight) ); + GetSizer()->SetItemMinSize( m_headerWin, wxSize(-1, m_headerWin->GetSize().y) ); #endif } else @@ -4594,7 +4597,7 @@ bool wxGenericListCtrl::GetSubItemRect(long item, return false; if ( m_mainWin->HasHeader() ) - rect.y += m_headerHeight + 1; + rect.y += m_headerWin->GetSize().y + 1; return true; }