I just found a bug in Slate but am not sure how to fix it. The bug is:
- When using UMG cursors as configured in UserInterfaceSettings, the DefaultCursor in this case
- If a widget is removed while it is under the cursor, for example an item in a list that gets removed when clicked on
- The Cursor will revert for the Windows cursor instead of the UMG one after the removal, until the mouse is moved
I traced it to FHittestGrid::GetBubblePathFromHitIndex(…). In there it seems the Widget already got cached for the current frame, before it got removed and by extension deleted since there are no more references to the TSharedPtr. Thus, bPathUninterrupted = CachedWidgetPtr.IsValid() becomes false, and the loop exits early, which leads to no widgets being queried for a cursor. Thus reversal to the Windows cursor.
I can fix it (game-code side) by keeping a pointer to the SWidgets by manually calling TakeWidget() in C++ code and holding on to them, but that’s complicated housekeeping.
How would I fix the cache in FHittestGrid when widgets are removed?