title: NSApplication endSheet: has no effect
body: <p>Ok, this is really stumping me: </p>
  
  <p>I create a modal sheet on a window as </p>
  
  <pre><code>-(IBAction) login: (id) sender {
  [NSApp beginSheet:loginWindow 
     modalForWindow:window 
      modalDelegate:nil 
     didEndSelector:nil 
        contextInfo:nil];
  }
  </code></pre>
  
  <p>and try to remove it with </p>
  
  <pre><code>-(IBAction) loginWindowCancelPressed:   (id) sender {
  debugLog(@"cancel");
  [NSApp endSheet:loginWindow];
  }
  </code></pre>
  
  <p>but it remains.</p>
  
  <p>I've checked all of the obvious things like IB connections and ensuring that window and loginWindow are present and in the normal state. </p>
  
  <p>So, the question is: Am I missing something? </p>