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
This commit is contained in:
Vadim Zeitlin
2010-03-06 00:31:04 +00:00
parent 1bab36277c
commit c1fae0d0ee
2 changed files with 7 additions and 5 deletions

View File

@@ -212,7 +212,6 @@ public:
m_ownsImageListState; m_ownsImageListState;
wxListHeaderWindow *m_headerWin; wxListHeaderWindow *m_headerWin;
wxListMainWindow *m_mainWin; wxListMainWindow *m_mainWin;
wxCoord m_headerHeight;
protected: protected:
virtual bool DoPopupMenu( wxMenu *menu, int x, int y ); virtual bool DoPopupMenu( wxMenu *menu, int x, int y );

View File

@@ -4272,7 +4272,6 @@ void wxGenericListCtrl::Init()
m_mainWin = NULL; m_mainWin = NULL;
m_headerWin = NULL; m_headerWin = NULL;
m_headerHeight = wxRendererNative::Get().GetHeaderButtonHeight(this);
} }
wxGenericListCtrl::~wxGenericListCtrl() wxGenericListCtrl::~wxGenericListCtrl()
@@ -4299,7 +4298,11 @@ void wxGenericListCtrl::CreateOrDestroyHeaderWindowAsNeeded()
( (
this, wxID_ANY, m_mainWin, this, wxID_ANY, m_mainWin,
wxPoint(0,0), wxPoint(0,0),
wxSize(GetClientSize().x, m_headerHeight), wxSize
(
GetClientSize().x,
wxRendererNative::Get().GetHeaderButtonHeight(this)
),
wxTAB_TRAVERSAL wxTAB_TRAVERSAL
); );
@@ -4313,7 +4316,7 @@ void wxGenericListCtrl::CreateOrDestroyHeaderWindowAsNeeded()
#ifdef __WXOSX__ #ifdef __WXOSX__
// TODO not tested under other platforms, remove the platform condition if // TODO not tested under other platforms, remove the platform condition if
// it works on those as well // 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 #endif
} }
else else
@@ -4594,7 +4597,7 @@ bool wxGenericListCtrl::GetSubItemRect(long item,
return false; return false;
if ( m_mainWin->HasHeader() ) if ( m_mainWin->HasHeader() )
rect.y += m_headerHeight + 1; rect.y += m_headerWin->GetSize().y + 1;
return true; return true;
} }