Basically, when you call ItemListbox::removeItem() it doesn't check to see if the item you are removing is currently selected (ItemListbox::d_lastSelected). So if you then call ItemListbox::getFirstSelectedItem() it returns an invalid pointer (assuming DestroyedByParent(True)). This was probably missed because removeItem() is actually derived from ItemListBase, which has no knowledge of ItemListbox::d_lastSelected.
Reproducibility: have not tried
Steps to reproduce: This can be easily reproduced: Code:
... CEGUI::WindowManager& cMan = CEGUI::WindowManager::getSingleton(); note memory address CEGUI::ItemListbox* pList = static_cast<CEGUI::ItemListbox*> (cMan.getWindow("EditChecklist/Frame/ItemListbox/Checklist"));
CEGUI::ItemEntry* pItem = (CEGUI::ItemEntry*)(CEGUI::WindowManager::getSingleton().createWindow("WindowsLook/ListboxItem")); pList->addItem(pItem); pItem->select(); pList->removeItem(pItem);
should return 0, but instead returns the memory address for the item that was just removed! pItem = pList->getFirstSelectedItem();
if (pItem) pItem->setText("Test"); crash and burn...