fix Issue 8832 - Segfault when accessing range returned by function that has delegate referencing local variables