Handle actor deletion undo in Unreal Editor?

I have some objects pointing to a scene component of an actor:

class MyObject 
{
    USceneComponent* Component;
}

When the actor is deleted, all its components are also deleted. So when the delete action is undone (transaction undo), the component pointer (in MyObject) becomes invalid. This is not a problem, but the pointer must be updated after the redo (when the actor and its components are automatically re-created).

How can I detect which actor was created by the redo?

UPROPERTY() did the trick!

in general you should UPROPERTY() on all UObject pointers (this include actors), as it breaks memory management, garbage cleaning and you have a risk to encounter invalid pointer.