Ensure that InsertItem doesn't lead to a crash in virtual mode, and don't use SortProperty to determined column clicked in virtual mode as we cannot sort virtual controls and it returns an invalid value.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43691 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -149,7 +149,10 @@ static pascal OSStatus wxMacListCtrlEventHandler( EventHandlerCallRef handler ,
|
|||||||
GetDataBrowserSortProperty(controlRef, &col);
|
GetDataBrowserSortProperty(controlRef, &col);
|
||||||
int column = col - kMinColumnId;
|
int column = col - kMinColumnId;
|
||||||
le.m_col = column;
|
le.m_col = column;
|
||||||
window->GetEventHandler()->ProcessEvent( le );
|
// FIXME: we can't use the sort property for virtual listctrls
|
||||||
|
// so we need to find a better way to determine which column was clicked...
|
||||||
|
if (!window->IsVirtual())
|
||||||
|
window->GetEventHandler()->ProcessEvent( le );
|
||||||
}
|
}
|
||||||
result = CallNextEventHandler(handler, event);
|
result = CallNextEventHandler(handler, event);
|
||||||
break;
|
break;
|
||||||
@@ -805,7 +808,6 @@ bool wxListCtrl::GetColumn(int col, wxListItem& item) const
|
|||||||
|
|
||||||
if (m_dbImpl)
|
if (m_dbImpl)
|
||||||
{
|
{
|
||||||
|
|
||||||
wxColumnList::compatibility_iterator node = m_colsInfo.Item( col );
|
wxColumnList::compatibility_iterator node = m_colsInfo.Item( col );
|
||||||
wxASSERT_MSG( node, _T("invalid column index in wxMacListCtrlItem") );
|
wxASSERT_MSG( node, _T("invalid column index in wxMacListCtrlItem") );
|
||||||
wxListItem* column = node->GetData();
|
wxListItem* column = node->GetData();
|
||||||
@@ -1818,7 +1820,7 @@ long wxListCtrl::InsertItem(wxListItem& info)
|
|||||||
if (m_genericImpl)
|
if (m_genericImpl)
|
||||||
return m_genericImpl->InsertItem(info);
|
return m_genericImpl->InsertItem(info);
|
||||||
|
|
||||||
if (m_dbImpl)
|
if (m_dbImpl && !IsVirtual())
|
||||||
{
|
{
|
||||||
int count = GetItemCount();
|
int count = GetItemCount();
|
||||||
|
|
||||||
@@ -1830,9 +1832,9 @@ long wxListCtrl::InsertItem(wxListItem& info)
|
|||||||
event.SetEventObject( this );
|
event.SetEventObject( this );
|
||||||
event.m_itemIndex = info.m_itemId;
|
event.m_itemIndex = info.m_itemId;
|
||||||
GetEventHandler()->ProcessEvent( event );
|
GetEventHandler()->ProcessEvent( event );
|
||||||
|
return info.m_itemId;
|
||||||
}
|
}
|
||||||
|
return -1;
|
||||||
return info.m_itemId;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
long wxListCtrl::InsertItem(long index, const wxString& label)
|
long wxListCtrl::InsertItem(long index, const wxString& label)
|
||||||
|
Reference in New Issue
Block a user