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
{
wxASSERT_MSG( !IsVirtual(), wxT("can't be used with virtual controls") );
{
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;
LV_ITEM item;
wxConvertToMSWListItem(this, info, item);
item.mask &= ~LVIF_PARAM;