Check that item ID is initialized when inserting it in wxListCtrl.
Using uninitialized ID happened to work by accident with 2.8 but it doesn't work any more, try to detect this as early as possible and give a clear explanation of why it doesn't to help fixing the broken code that used to accidentally work. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@71381 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
ae4375b878
commit
912886949a
@ -1656,6 +1656,12 @@ long wxListCtrl::InsertItem(const wxListItem& info)
|
||||
{
|
||||
wxASSERT_MSG( !IsVirtual(), wxT("can't be used with virtual controls") );
|
||||
|
||||
// In 2.8 it was possible to succeed inserting an item without initializing
|
||||
// its ID as it defaulted to 0. This was however never supported and in 2.9
|
||||
// the ID is -1 by default and inserting it simply fails, but it might be
|
||||
// not obvious why does it happen, so check it proactively.
|
||||
wxASSERT_MSG( info.m_itemId != -1, wxS("Item ID must be set.") );
|
||||
|
||||
LV_ITEM item;
|
||||
wxConvertToMSWListItem(this, info, item);
|
||||
item.mask &= ~LVIF_PARAM;
|
||||
|
Loading…
Reference in New Issue
Block a user