Just to wrap things up. This is the actual answer to the original post, BUT there still one error, for what I can understand (other than the missing validity check which Shohei noted himself).
I spent quite a while trying to understand why RootWidget->Slot is null for me while it’s not for Shohei. Well the answer is that it’s null for Shohei too, we just both wrapped the operations on it inside of an if block, which never executes. Root widget has no container, until is passed to container->AddChild(RootWidget) [which makes it no longer a root widget], and the container gives the slot to the widget.
So, in the code screenshot above everything between RootWidget = …; and WidgetTree->RootWidget = RootWidget; is not needed as it won’t ever be executed.
Please correct me if I’m wrong, bacause with UE I’m never sure I understand.