MultiColumnList issue


30-04-2007 08:37:38

Ok, so I'm using a CEGUI MultiColumnList and I'm hitting an issue when adding items to it.

So I'm defining a list box item in a local function scope, then add it to a list. If I don't hold those items in some global/class scope I get a crash. Is this Python cleaning them up while they're still being used by the MultiColumnList?

runtime error R6025
- pure virtual function call

The code in question is below, I'm really confused by this one.

contextList = cegui.WindowManager.getSingleton().getWindow("PySim/Planet/ContextPanel/MultiColumn")


for i in range(0, contextList.columnCount):

#Add columns to the context panel, then add entries.

colWidth = cegui.UDim(0.25, 0.0)

contextList.addColumn("Item", 0, colWidth)
contextList.addColumn("Price", 1, colWidth)

red = cegui.colour(1.0, 0.0, 0.0, 0.5)
black = cegui.colour(0.0, 0.0, 0.0, 1.0)

itemList = self.planet.items

i = 0
for planetObjIndex, (itemID, cost) in enumerate(itemList):
item = self.gameInfo.items[itemID]

itemCost = cost
itemName =

itemRowID = contextList.addRow()

itemCostListItem = cegui.ListboxTextItem(itemCost.__str__(), planetObjIndex)
itemNameListItem = cegui.ListboxTextItem(itemName, planetObjIndex)

contextList.setItem(itemNameListItem, 0, itemRowID)
contextList.setItem(itemCostListItem, 1, itemRowID)



itemCostListItem.setSelectionBrushImage("TaharezLook", "ListboxSelectionBrush")
itemNameListItem.setSelectionBrushImage("TaharezLook", "ListboxSelectionBrush")


30-04-2007 11:15:15

Yes this indeed is a case where the object needs to be held by python...

If you look at the C++ demos for CEGUI you'll notice that list items are specificially created with the C 'new' operator. Typically when this happens it means we need to keep things around in Python when the same object type is created..

There has been discussion about automatically wrapping these but I have yet to see how all the use cases can be automatically determined (so they can be fixed)...

If you look at a number of the Python-Ogre demos (OgreOde, CEGUI, OgreNewt) you will see cases where I append the new objects to a master array - then I let python clean things up at close time...




30-04-2007 16:15:54

Ahh, ok, thanks.