fix crash when calling InsertColumn() on a wxListCtrl with wxLC_NO_HEADER style
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@58453 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -4188,9 +4188,12 @@ void wxListMainWindow::OnScroll(wxScrollWinEvent& event)
|
|||||||
wxGenericListCtrl* lc = GetListCtrl();
|
wxGenericListCtrl* lc = GetListCtrl();
|
||||||
wxCHECK_RET( lc, _T("no listctrl window?") );
|
wxCHECK_RET( lc, _T("no listctrl window?") );
|
||||||
|
|
||||||
|
if (lc->m_headerWin) // when we use wxLC_NO_HEADER, m_headerWin==NULL
|
||||||
|
{
|
||||||
lc->m_headerWin->Refresh();
|
lc->m_headerWin->Refresh();
|
||||||
lc->m_headerWin->Update();
|
lc->m_headerWin->Update();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxListMainWindow::GetCountPerPage() const
|
int wxListMainWindow::GetCountPerPage() const
|
||||||
@@ -4871,14 +4874,13 @@ long wxGenericListCtrl::InsertItem( long index, const wxString &label, int image
|
|||||||
|
|
||||||
long wxGenericListCtrl::InsertColumn( long col, wxListItem &item )
|
long wxGenericListCtrl::InsertColumn( long col, wxListItem &item )
|
||||||
{
|
{
|
||||||
wxCHECK_MSG( m_headerWin, -1, _T("can't add column in non report mode") );
|
wxCHECK_MSG( InReportView(), -1, _T("can't add column in non report mode") );
|
||||||
|
|
||||||
m_mainWin->InsertColumn( col, item );
|
m_mainWin->InsertColumn( col, item );
|
||||||
|
|
||||||
// if we hadn't had a header before but have one now
|
// NOTE: if wxLC_NO_HEADER was given, then we are in report view mode but
|
||||||
// then we need to relayout the window
|
// still have m_headerWin==NULL
|
||||||
// if ( GetColumnCount() == 1 && m_mainWin->HasHeader() )
|
if (m_headerWin)
|
||||||
|
|
||||||
m_headerWin->Refresh();
|
m_headerWin->Refresh();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user