How do you properly delete widgets. Removing them from viewport or removing them from parent seems to still keep them in memory. For example I add widgets to a context menu. Close the context menu (and remove from parent/viewport) then I GetAllWidgetsOfClass that are not top level only and it will return the context menu widget and all it’s children still. They also don’t seem to be garbage collected even though they are UObjects.
If I manually call delete on them, then I can get rid of them but the engine will crash when it tries to remove them itself. I assume that this is because the child widgets are not destroyed and their outer is now invalid. Before I go and write a recursive function to destroy all the widgets manually, I figured I’d ask if this is already done somewhere. It seems like a bit of an oversight if every widget ever created is stuck in memory.