title: Not receiving NSWindowWillCloseNotifications
body: <p>In the application I am creating, I have a welcome window with a list of recent documents (similar in functionality to the new Xcode 4's welcome window). I am registering both the application's delegate and a view controller in the welcome window for posted <code>NSWindowWillCloseNotification</code>. Unfortunately, only the applications delegate is ever getting notified of this event.</p>
  
  <p>I've tried the following, all with the same behavior (the window controller is not notified):</p>
  
  <ul>
  <li>Removing the AppDelegate's notification registration code, hoping that somehow it was 'consuming' the notification.</li>
  <li>Changing the method on the view controller to <code>-(void)windowIsClosing:</code> such that it isn't the same name as the app delegate (quite the long shot, but I had to try)</li>
  <li>Moving the <code>addObserver:...</code> call in the ViewController to else where in the code (so its not invoked during the initializer, if somehow that mattered).</li>
  <li>I do de-register my view controller from the notification center during its <code>dealloc</code> method, but I've ensured that the dealloc method is getting called after the window is closed not during the closing.</li>
  </ul>
  
  <p>I also tried for listening to other events, such as NSWindowWillMoveNotification in both the delegate and the controller, and once again the delegate gets notified but not the view controller. My view controller is not part of the first responder chain, but that shouldn't matter since I'm registering for a notification not looking to handle nil-targetted actions.</p>
  
  <p>Therefore, why is my controller not being notified of the window closing events but my app delegate is?</p>
  
  <p>The relevant code is as follows....
  App Delegate:</p>
  
  <pre><code>@interface AppDelegate : NSObject &lt;NSApplicationDelegate&gt; {
  }
  @end
  
  @implementation AppDelegate
  - (void)applicationDidFinishLaunching:(NSNotification *)aNotification {
      [[NSNotificationCenter defaultCenter] addObserver:self 
                                               selector:@selector(windowClosing:) 
                                                   name:NSWindowWillCloseNotification 
                                                 object:nil];
      // other initialization stuff
      [self showWelcomeWindow];
  }
  
  - (void)windowClosing:(NSNotification*)aNotification {
      // this method gets called when any window is closing
  }
  @end
  </code></pre>
  
  <p>Controller:</p>
  
  <pre><code>@interface ViewController : NSObject {
  }
  @end
  
  @implementation ViewController
  - (id)init {
      self = [super init];
      if (self) {
          [[NSNotificationCenter defaultCenter] addObserver:self
                                                   selector:@selector(windowClosing:)
                                                       name:NSWindowWillCloseNotification
                                                     object:nil];
      }
      return self;
  }
  
  - (void)windowClosing:(NSNotification*)aNotification {
      // this method does not called when window is closing
  }
  @end
  </code></pre>