• 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: "Gerriet M. Denkmann" <email@hidden>
  • Date: Thu, 23 Oct 2014 00:46:30 +0700

> On 22 Oct 2014, at 03:17, Greg Parker <email@hidden> wrote:
>
>
>> On Oct 21, 2014, at 2:44 AM, Gerriet M. Denkmann <email@hidden> wrote:
>>
>> 10.10, Xcode 6.1, using Arc.
>>
>> The following code works fine, with USE_INVOCATION defined or not:
>
> [...]
>
>> Without USE_INVOCATION defined, I get some compiler warning about potential leaks, because selector is unknown.
>>
>> But with USE_INVOCATION defined, it will crash later (when all has been done), obviously while cleaning an AutoreleasePool:
>
> [...]
>
>> Seems like Arc (or I) is somehow confused.
>>
>> Any help would be greatly appreciated.
>
> Start with the Allocations instrument. It will show you the retain/release history of the dead object.
>
> (My guess is that the bug is the call to -getReturnValue:. That method simply copies the return value's bytes into the destination variable, but ARC thinks the destination variable stores a retained pointer. The Allocations instrument should show that the returned object is the one that is used after deallocation.)

I tried (with zombies on):

[ invocation invoke ];
NSDictionary *a;
[ invocation getReturnValue: &a ];
NSLog(@"%s got new %p",__FUNCTION__, a);

Result:
...
got new 0x6100004475c0
 *** -[__NSDictionaryM release]: message sent to deallocated instance 0x6100004475c0


This seems to prove your guess that " the bug is the call to -getReturnValue:".

But how to fix this?

Kind regards,

Gerriet.


_______________________________________________

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

  • Prev by Date: Re: iOS table views using multiple cell subclasses.
  • Next by Date: Re: NSInvocation crashes in AutoreleasePool
  • Previous by thread: Re: NSInvocation crashes in AutoreleasePool
  • Next by thread: Re: NSInvocation crashes in AutoreleasePool
  • Index(es):
    • Date
    • Thread