I have a ListView widget in an EditorUtilityWidget.
The ListView has an EntryWidgetClass set to a widget with UserObjectListEntry interface, and the relevant functions and events are set up currently just to store and send the represented object.
In the EditorUtilityWidget, I Get All Level Actors, filter them by a class, and pass the resulting array into Set List Items called on the ListView.
This all works.
But, if I manually delete one of the objects in the world editor, the editor crashes on the error:
LogSlate: Warning: WidgetMapToItem length (6) does not match ItemsWithGeneratedWidgets length (5). This is often because the same item is in the list more than once in ListViewT<ItemType> [ListViewBase.h(219)]. Diagnostics follow.
The diagnostics that follow show what you’d expect, the 6 ItemToWidgetMap entries. The 6 WidgetMapToItem entries, and the 5 ItemsWithGeneratedWidgets entries (because I deleted one manually.)
So, I understand the problem here, but I don’t know how to resolve it.
I have tried:
- Regenerating the ListView
OnEntryReleased and also on the
ListObjectWidget’s OnEntryReleased. - Regenerating the ListView on the
object’s OnDestroyed and OnEndPlay
events. - Calling Set Items on the ListView
on the object’s OnDestroyed and
OnEndPlay events. - There is also a tick event on the EditorUtilityWidget that reacts to a change in number of actors that is meant to refresh the panel, but includes the clearing and setting of this ListView… crashes before this happens.
I can’t seem to figure out what the engine wants me to do to intercept this event before Slate ends up with the mismatched item list.
I’m not sure what else I’ve tried- it’s hard to keep track and be methodical when I have to go through crash recovery processes every time I try something new.
Just trying to figure out the best practices for accounting for the manual deletion of an object that is referenced by a listview.