title: CATiledLayer crashes when drawing previously prepared CGPath
body: <p>I am using CATiledLayer as backing layer for my UIView, which I have put inside UIScrollView. In init method of my view I am creating CGPathRef object which draws simple line. When I am trying to draw this path inside drawLayer:inContext it occasionally crashes with EXEC_BAD_ACCESS (rarely) when I am scrolling / zooming.</p>
  
  <p>The code is very simple, I am using only standard CG* functions:</p>
  
  <pre><code>- (id)initWithFrame:(CGRect)frame
  {
      self = [super initWithFrame:frame];
      if (self) {
          CATiledLayer *tiledLayer = (CATiledLayer *)[self layer];
          tiledLayer.levelsOfDetail = 10;
          tiledLayer.levelsOfDetailBias = 5;
          tiledLayer.tileSize = CGSizeMake(512.0, 512.0);
  
          CGMutablePathRef mutablePath = CGPathCreateMutable();
          CGPathMoveToPoint(mutablePath, nil, 0, 0);
          CGPathAddLineToPoint(mutablePath, nil, 700, 700);
          path = CGPathCreateCopy(mutablePath);
          CGPathRelease(mutablePath);
      }
      return self;
  }
  
  + (Class) layerClass {
      return [CATiledLayer class];
  }
  
  - (void) drawRect:(CGRect)rect {
  }
  
  - (void) drawLayer:(CALayer *)layer inContext:(CGContextRef)ctx {
      CGContextSetRGBFillColor(ctx, 1, 1, 1, 1);
      CGContextFillRect(ctx, self.bounds);
  
      CGContextSetLineWidth(ctx, 5);
  
      CGContextAddPath(ctx, path);
      CGContextDrawPath(ctx, kCGPathStroke);
  }
  
  - (void)dealloc {
      [super dealloc];
  }
  </code></pre>
  
  <p>UPDATE:
  I have noiced that this problem exists only on iOS 5, it works fine on 4.3</p>