UObject ownership from non-UObject

I am trying to create a UObject from something that is not a UObject subclass (a Slate window), but I don’t know how to preserve ownership and release it in a sensible way.

This is what I have right now, what should it be?

// on creation
UMyObject* pObj = NewObject<UMyObject>();
MySharedPtr = TSharedPtr<UMyObject>(pObj);

// in destructor