Fix assertion violations in try_window_id (Bug#19511)