• 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: Removing Applications from the Dock Programmatically
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Removing Applications from the Dock Programmatically


  • Subject: Re: Removing Applications from the Dock Programmatically
  • From: "Sherm Pendley" <email@hidden>
  • Date: Wed, 27 Aug 2008 14:43:01 -0400

On Wed, Aug 27, 2008 at 2:24 PM, Ken Worley <email@hidden> wrote:
>
> On Aug 27, 2008, at 12:05 PM, Sherm Pendley wrote:
>
>> On Wed, Aug 27, 2008 at 1:48 PM, Kevin Kicklighter
>> <email@hidden> wrote:
>>>
>>>              NSDictionary *theError = [[[NSDictionary alloc] init]
>>> autorelease];
>>>
>>>              [quitScript executeAndReturnError:&theError];
>>>      }
>>
>> That still leaks the dictionary you created. Didn't you get my message
>> about that? You should do this instead:
>>
>>  NSDictionary *theError = nil;
>>  [quitScript executeAndReturnError: &theError];
>
> It's autoreleased - how could that leak?

You're right - I missed the autorelease.

The point stands though; you don't need to create the dictionary at
all, and doing so is just wasted CPU cycles. The
-executeAndReturnError: method will create a dictionary if one is
needed. That's why theError is passed by reference, so the method can
dereference it.

Discussion of this can be found at the URL below. It uses NSError
objects, but the general idea is the same:

    <http://developer.apple.com/documentation/Cocoa/Conceptual/ErrorHandlingCocoa/CreateCustomizeNSError/chapter_4_section_2.html>

sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net
_______________________________________________

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: 
 >Removing Applications from the Dock Programmatically (From: Kevin Kicklighter <email@hidden>)
 >Re: Removing Applications from the Dock Programmatically (From: Graff <email@hidden>)
 >Re: Removing Applications from the Dock Programmatically (From: Negm-Awad Amin <email@hidden>)
 >Re: Removing Applications from the Dock Programmatically (From: Kevin Kicklighter <email@hidden>)
 >Re: Removing Applications from the Dock Programmatically (From: "Sherm Pendley" <email@hidden>)
 >Re: Removing Applications from the Dock Programmatically (From: Ken Worley <email@hidden>)

  • Prev by Date: Re: NSCalendarDate to be deprecated
  • Next by Date: Re: File Extensions Problem
  • Previous by thread: Re: Removing Applications from the Dock Programmatically
  • Next by thread: xcode: how to not Go with Instruments
  • Index(es):
    • Date
    • Thread