<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -20,6 +20,9 @@
 - (CGRect)finBoundsForCurrentBounds;
 - (CGPoint)finAnchorPointForCurrentBounds;
 
+- (void)setupAnimTimer;
+- (void)disposeAnimTimer;
+
 @end
 
 
@@ -104,27 +107,42 @@
     [self setNeedsDisplay];
 }
 
-- (void)startProgressAnimation {
-   _animationTimer = [[NSTimer timerWithTimeInterval:(NSTimeInterval)0.05
-                                              target:self
-                                            selector:@selector(advancePosition)
-                                            userInfo:nil
-                                             repeats:YES] retain];
-                                         
-   [_animationTimer setFireDate:[NSDate date]];
-   [[NSRunLoop currentRunLoop] addTimer:_animationTimer forMode:NSDefaultRunLoopMode];
-   [[NSRunLoop currentRunLoop] addTimer:_animationTimer forMode:NSEventTrackingRunLoopMode];
-   
-    self.hidden = NO;
-    _isRunning = YES;
+- (void)setupAnimTimer
+{
+    // Just to be safe kill any existing timer.
+    [self disposeAnimTimer];
+
+    // Why animate if not visible?  viewDidMoveToWindow will re-call this method when needed.
+    _animationTimer = [[NSTimer timerWithTimeInterval:(NSTimeInterval)0.05
+                                               target:self
+                                             selector:@selector(advancePosition)
+                                             userInfo:nil
+                                              repeats:YES] retain];
+
+    [_animationTimer setFireDate:[NSDate date]];
+    [[NSRunLoop currentRunLoop] addTimer:_animationTimer forMode:NSRunLoopCommonModes];
+    [[NSRunLoop currentRunLoop] addTimer:_animationTimer forMode:NSDefaultRunLoopMode];
+    [[NSRunLoop currentRunLoop] addTimer:_animationTimer forMode:NSEventTrackingRunLoopMode];
 }
 
-- (void)stopProgressAnimation {
+- (void)disposeAnimTimer
+{
     [_animationTimer invalidate];
     [_animationTimer release];
     _animationTimer = nil;
+}
+
+- (void)startProgressAnimation {
+    self.hidden = NO;
+    _isRunning = YES;
     
+    [self setupAnimTimer];
+}
+
+- (void)stopProgressAnimation {
     _isRunning = NO;
+
+    [self disposeAnimTimer];
     
     [self setNeedsDisplay];
 }</diff>
      <filename>Code/YRKSpinningProgressIndicatorLayer.m</filename>
    </modified>
    <modified>
      <diff>@@ -246,6 +246,7 @@
 				GCC_OPTIMIZATION_LEVEL = 0;
 				GCC_PRECOMPILE_PREFIX_HEADER = YES;
 				GCC_PREFIX_HEADER = SPILDemo_Prefix.pch;
+				GCC_TREAT_WARNINGS_AS_ERRORS = YES;
 				INFOPLIST_FILE = Resources/Info.plist;
 				INSTALL_PATH = &quot;$(HOME)/Applications&quot;;
 				PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = YES;
@@ -263,6 +264,7 @@
 				GCC_MODEL_TUNING = G5;
 				GCC_PRECOMPILE_PREFIX_HEADER = YES;
 				GCC_PREFIX_HEADER = SPILDemo_Prefix.pch;
+				GCC_TREAT_WARNINGS_AS_ERRORS = YES;
 				INFOPLIST_FILE = Resources/Info.plist;
 				INSTALL_PATH = &quot;$(HOME)/Applications&quot;;
 				PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR = YES;</diff>
      <filename>SPILDemo.xcodeproj/project.pbxproj</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>b9bc9fa68020ed977fb3534d22dc8b128f700349</id>
    </parent>
  </parents>
  <author>
    <name>Kelan Champagne</name>
    <email>kelan@yeahrightkeller.com</email>
  </author>
  <url>http://github.com/kelan/yrk-spinning-progress-indicator-layer/commit/8d182032fd6423df281fd6e802694fd9ff536704</url>
  <id>8d182032fd6423df281fd6e802694fd9ff536704</id>
  <committed-date>2009-06-02T21:36:30-07:00</committed-date>
  <authored-date>2009-05-01T01:38:38-07:00</authored-date>
  <message>Implement fix from Eric Roccasecca (via email)

Guards against an issue when starting the spinner multiple times.  It will now always kill the timer and make a new one when told to start animating, instead of starting more times (which cause the animation to run faster and faster).

Didn't apply the other fix (about the potential memory leak) because there is no -viewDidMoveToWindow method on CALayer.  Need to check if there is a corresponding method on CALayer to use for that purpose.

See [here](http://github.com/kelan/yrk-spinning-progress-indicator/commit/207c8b4c7cf4f6efd0d8de05fe74acc867f48e79) for the corresponding fix in the NSView-based project</message>
  <tree>92ec2a3c49121369d60caa77683cdf930af8823d</tree>
  <committer>
    <name>Kelan Champagne</name>
    <email>kelan@yeahrightkeller.com</email>
  </committer>
</commit>
