• 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: NSInvocation crashes in AutoreleasePool
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSInvocation crashes in AutoreleasePool


  • Subject: Re: NSInvocation crashes in AutoreleasePool
  • From: Greg Parker <email@hidden>
  • Date: Wed, 22 Oct 2014 14:31:46 -0700

> On Oct 22, 2014, at 12:04 PM, Gerriet M. Denkmann <email@hidden> wrote:
>
>> On 23 Oct 2014, at 01:37, Scott Ribe <email@hidden> wrote:
>>
>> On Oct 22, 2014, at 12:19 PM, Jonathan Mitchell <email@hidden> wrote:
>>>
>>> Surely the code that returns the object pointed to by temp has to ensure that the object has been correctly retained?
>>
>> So, maybe __autorelease?
>
> Tried:
> [ iv invoke ];
> NSDictionary * __autoreleasing a;
> [ iv getReturnValue: &a ];
>
> Result: no crash.
>
> So, indeed, __autoreleasing seems to be the answer.
> ( __autoreleasing is used to denote arguments that are passed by reference (id *) and are autoreleased on return.)

__autoreleasing is not correct, although it might happen to work today. __autoreleasing means the value stored in the variable is autoreleased. -getReturnValue: does not autorelease the value it stores, so the annotation does not match the behavior.

The annotation that matches the behavior is __unsafe_unretained. Use that instead.


--
Greg Parker     email@hidden     Runtime Wrangler



_______________________________________________

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: NSInvocation crashes in AutoreleasePool
      • From: "Gerriet M. Denkmann" <email@hidden>
References: 
 >NSInvocation crashes in AutoreleasePool (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: NSInvocation crashes in AutoreleasePool (From: Greg Parker <email@hidden>)
 >Re: NSInvocation crashes in AutoreleasePool (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: NSInvocation crashes in AutoreleasePool (From: Scott Ribe <email@hidden>)
 >Re: NSInvocation crashes in AutoreleasePool (From: "Gerriet M. Denkmann" <email@hidden>)
 >Re: NSInvocation crashes in AutoreleasePool (From: Jonathan Mitchell <email@hidden>)
 >Re: NSInvocation crashes in AutoreleasePool (From: Scott Ribe <email@hidden>)
 >Re: NSInvocation crashes in AutoreleasePool (From: "Gerriet M. Denkmann" <email@hidden>)

  • Prev by Date: Re: Crash with ARC enabled on Xcode 6.1
  • Next by Date: Re: Crash with ARC enabled on Xcode 6.1
  • Previous by thread: Re: NSInvocation crashes in AutoreleasePool
  • Next by thread: Re: NSInvocation crashes in AutoreleasePool
  • Index(es):
    • Date
    • Thread