The foreach_sub_texture_in_region implementation tries to forward the function on to its child texture but it was mistakenly forwarding back on to itself so it would just recurse endlessly and crash.