I believe SWeakWidget is used there to prevent the engine code holding onto a game code reference when performing a hot-reload:
I would hope that the TestUIWidget pointer (see the SAssignNew) will be keeping the widget alive (assuming that’s a member variable?).