• 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: showing window causes EXC_BAD_ACCESS
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: showing window causes EXC_BAD_ACCESS


  • Subject: Re: showing window causes EXC_BAD_ACCESS
  • From: Uli Kusterer <email@hidden>
  • Date: Sat, 27 Sep 2008 22:44:10 +0200

On 27.09.2008, at 22:13, Michael Ash wrote:
But suddenly you're back to having to think about the global picture
of who owns objects, which is what Cocoa's memory management system is
supposed to avoid.


Retains and releases should be balanced. This doesn't just means that
they should ultimately be equal in number, it also means that the same
entity should be doing both. "Release when closed" breaks the
fundamental memory management rules and, as a consequence, makes it
much more complicated to think about how the program works.

You're misunderstanding the purpose of Cocoa's memory management system: It's not about not having to care who owns what, it's about not having to worry about shared ownership. There are many cases (threading and creation of objects come to mind) where ownership is handed from one object to the other.


In this case, you specify in the NIB that you want your window to release itself, and you haven't written your outlet in a way that it retains the window. If you expect your window to not go away when closed, you're expecting too much.

That said, I fully agree on one partial point you raised: 'Release when closed' is dangerous and complicates matters. It should be off by default, and it's very likely that nobody would miss it. That said, I don't know what it was originally introduced for. Any old NeXTies here who know?

Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de





_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: showing window causes EXC_BAD_ACCESS
      • From: Negm-Awad Amin <email@hidden>
    • Re: showing window causes EXC_BAD_ACCESS
      • From: "Michael Ash" <email@hidden>
    • Re: showing window causes EXC_BAD_ACCESS
      • From: Michael Nickerson <email@hidden>
References: 
 >Re: showing window causes EXC_BAD_ACCESS (From: Charles Steinman <email@hidden>)
 >Re: showing window causes EXC_BAD_ACCESS (From: Daniel Child <email@hidden>)
 >Re: showing window causes EXC_BAD_ACCESS (From: Uli Kusterer <email@hidden>)
 >Re: showing window causes EXC_BAD_ACCESS (From: "Michael Ash" <email@hidden>)

  • Prev by Date: Re: Creating an NSForm programmatically & tabbing
  • Next by Date: sizeof(unsigned long long)
  • Previous by thread: Re: showing window causes EXC_BAD_ACCESS
  • Next by thread: Re: showing window causes EXC_BAD_ACCESS
  • Index(es):
    • Date
    • Thread