Fix Gallery crash while flipping images quickly.