title: Pause and resume repeatable NSTimer when closing and opening window
body: <p>Now I know there are questions on SO about NSTimer pause, but none on repeatable and closing/opening windows.
  Toggeling pause works perfect (checked using button).
  Reopening window gives BAD_ACCESS error.</p>
  
  <pre><code>- (void)awakeFromNib
  {
      self.timer = [[NSTimer scheduledTimerWithTimeInterval:0.85
                                                 target:self
                                               selector:@selector(populateTable:)
                                               userInfo:nil
                                                repeats:YES] retain];
  }
  
  -(IBAction)fireUpTableWindow:(id)sender
  {
      [aTableWindow makeKeyAndOrderFront:self];
      [self resumeTimer:timer];
  }
  
  
  NSDate *pauseStart, *previousFireDate;
  
  -(void) pauseTimer:timer
  {
      pauseStart = [[NSDate dateWithTimeIntervalSinceNow:0] retain];    
      previousFireDate = [[timer fireDate] retain];
      [timer setFireDate:[NSDate distantFuture]];
  }
  
  -(void) resumeTimer:timer
  {
      float pauseTime = -1*[pauseStart timeIntervalSinceNow];
      [timer setFireDate:[previousFireDate initWithTimeInterval:pauseTime sinceDate:previousFireDate]];
      [pauseStart release];
      [previousFireDate release];
  }
  
  - (IBAction)closeTableWindow:(id)sender
  {
      [self pauseTimer:timer];
      [self-&gt;aTableWindow close];
      [self release];
  }
  }
  </code></pre>