title: How to handle retain count for controllers saved in AppDelegate?
body: <p>MyAppDelegate is doing some background stuff and needs to refresh several views during this time, so I am saving a reference to each controller that gets created.</p>
  
  <pre><code>@interface MyAppDelegate : NSObject &lt;UIApplicationDelegate&gt; {
      SomethingController *currentSomethingController;
  }
  @property (nonatomic, retain) SomethingController *currentSomethingController;
  </code></pre>
  
  <p>This is done to open the controller:</p>
  
  <pre><code>- (void)openSomethingController {
      MyAppDelegate * app = [[UIApplication sharedApplication] delegate];
      app.currentSomethingController = [[SomethingController alloc] init];
      [self presentModalViewController:app.currentSomethingController animated:NO];
  }
  </code></pre>
  
  <p>And this is called inside the controller to close it:</p>
  
  <pre><code>- (void)dismissSelf
  {
      MyAppDelegate * app = [[UIApplication sharedApplication] delegate];
      [app.currentSomethingController release];
      app.currentSomethingController = nil;
  [self dismissModalViewControllerAnimated:NO];
  }
  </code></pre>
  
  <p>In MyAppDelegate the controllers is sending messages to the controller: </p>
  
  <pre><code>- (void)longRunningBackgroundTask {
      [currentSomethingController performSelectorOnMainThread:@selector(updateData) withObject:nil waitUntilDone:YES];
  }
  </code></pre>
  
  <p>If I do Product->Analyse I get "potential leak" and "incorrect decrement" warnings. What would be the right way to do this or assuming my approach is okay, how do I tell the analysis tool to ignore those lines?</p>