• 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: ScreenSaverView gets instantiated several times
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: ScreenSaverView gets instantiated several times


  • Subject: Re: ScreenSaverView gets instantiated several times
  • From: Uli Kusterer <email@hidden>
  • Date: Mon, 5 Oct 2009 11:42:10 +0200

On 05.10.2009, at 10:39, Gabriel Zachmann wrote:
I supposed that the screen saver manager would just call - initWithFrame: again.

-init... methods are only called once on an instance, when it is alloced and inited. Calling it several times on the same instance that has already been initialized goes against every bit of documentation on AppKit, and more importantly, Objective C out there. I think you should get yourself a good book about Objective C, it sounds like the one you learned from so far omitted some very important aspects of Objective C.


Extra credit: the user has multiple displays attached, "Main screen only" option is off, and the user clicks the Test button or activates your screen saver (hot corner, inactivity). What do you expect will happen then?

I assumed it would load(!) & run the screen saver bundle multiple times.
And it's not that this assumption is complete nonsense, is it?

You cannot load a bundle several times on the Mac. That's because you can't unload a bundle. After all, you could be defining string constants or custom subclasses in your bundle, and someone in the program that loaded your bundle could be retaining one of those objects. Unloading it would make your application crash, because suddenly the code the class points to or the TEXT section from which the constant string came would be gone.


Cheers,
-- Uli Kusterer
"The witnesses of TeachText are everywhere..."



_______________________________________________

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


References: 
 >ScreenSaverView gets instantiated several times (From: Gabriel Zachmann <email@hidden>)
 >Re: ScreenSaverView gets instantiated several times (From: Michael Babin <email@hidden>)
 >Re: ScreenSaverView gets instantiated several times (From: Gabriel Zachmann <email@hidden>)

  • Prev by Date: Re: ScreenSaverView gets instantiated several times
  • Next by Date: Re: Bundle is not using icon or CFBundleIdentifier
  • Previous by thread: Re: ScreenSaverView gets instantiated several times
  • Next by thread: Re: ScreenSaverView gets instantiated several times
  • Index(es):
    • Date
    • Thread