• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Behavior of autoreleased window controller for closing window vs. app termination
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Behavior of autoreleased window controller for closing window vs. app termination


  • Subject: Re: Behavior of autoreleased window controller for closing window vs. app termination
  • From: Matt Neuburg <email@hidden>
  • Date: Sun, 6 Oct 2002 08:14:02 -0700

On Mon, 30 Sep 2002 17:18:26 -0700, Alan Nilsson <email@hidden> said:

>What is really confusing me is that when I close the window,
>'windowWillClose' gets called once, but if I terminate the app with a window
>open, 'windowWillClose' gets called twice.
>
>-(void) windowWillClose:(NSNotification *)aNotification
>{
> [self autorelease];
> NSLog(@"count = %d for %d",[self retainCount],[currentEmp personID]);
>}
>
>
>Results:
>2002-09-30 17:14:19.516 STE User Tool[1664] Creating User Controller for
>295207
>2002-09-30 17:14:23.040 STE User Tool[1664] retain count = 1 for 295207
>2002-09-30 17:14:23.040 STE User Tool[1664] retain count = 1 for 295207
>2002-09-30 17:14:23.072 STE User Tool[1664] Deallocating
>
>STE User Tool has exited due to signal 11 (SIGSEGV).
>
>Can anyone give me any ideas of what is going wrong? Why I am seeing 2
>calls to windowWillClose which obviously is over-releasing the window.

It might help to include a test at the beginning of windowWillClose to make
sure that the window that generated the notification is the window you're
interested in. In my app (MemoryStick) I had a similar problem. I have two
possible windows, the main window and prefs window. But on quit I get a
windowWillClose notification from a mysterious "third window" whose origin
and nature I was never able to determine. I solved my crash-on-quit by
ignoring this notification. If you look back through the archives you can
find the discussion of this.

m.
--

matt neuburg, phd = email@hidden, http://www.tidbits.com/matt
pantes anthropoi tou eidenai oregontai phusei
Subscribe to TidBITS! It's free and smart. http://www.tidbits.com/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

  • Follow-Ups:
    • Re: Behavior of autoreleased window controller for closing window vs. app termination
      • From: Bill Cheeseman <email@hidden>
  • Prev by Date: Re: Launching a Cocoa application with arguments
  • Next by Date: Re: relation between NSTextStorage and appended NSAttributedString
  • Previous by thread: Re: Behavior of autoreleased window controller for closing window vs. app termination
  • Next by thread: Re: Behavior of autoreleased window controller for closing window vs. app termination
  • Index(es):
    • Date
    • Thread