GUI: Avoid infinite loop in sheet reordering.