Do not try to create an undo image with selection when locking undo manager, because contents might change.