• 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: Hang during AESend
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Hang during AESend


  • Subject: Re: Hang during AESend
  • From: Trygve Inda <email@hidden>
  • Date: Tue, 13 May 2014 14:22:16 -0700
  • Thread-topic: Hang during AESend

> On May 13, 2014, at 13:03 , Trygve Inda <email@hidden> wrote:
>
>> NSAppleEventDescriptor *appleEvent = [NSAppleEventDescriptor
>> appleEventWithEventClass: kMyAEClass
>> eventID: kMyAEEventID
>> targetDescriptor: targetDescriptor
>> returnID: kAutoGenerateReturnID
>> transactionID: kAnyTransactionID];
>
>> AESendMessage([appleEvent aeDesc], NULL, kAENoReply | kAENeverInteract,
>> kAEDefaultTimeout);
>
> What memory model? ARC?
>
> You’re getting back back a NSAppleEventDescriptor with +0 semantics, which
> means (if ARC) it’s going to be locally retained, then released when it goes
> out of scope (possibly a scope optimized optimized to the last reference).
>
> What you’re passing to AESendMessage is an interior pointer (‘aeDesc’ is
> marked NS_RETURNS_INNER_POINTER in the headers). AFAIK that keeps the
> underlying object alive *in the calling code* long enough for the interior
> pointer to be passed safely into the called function, but no longer.
>
> In particular, I don’t know that the interior pointer can be assumed to be
> valid for the entire length of the called function’s execution. Of course,
> there’d have to be asynchronous activity (or perhaps a autorelease pool drain
> inside the called function) for this to matter, but since you’re not asking
> for a reply, that seems possible.
>
> So, my theory: memory management bug in your code. A simple way to test this
> would be to put ‘[appleEvent self];’ after the AESendMessage call, and see if
> the problem goes away.
>

I am not using ARC.

Adding [appleEvent self]; after AESendMessage  made no difference at all.

When the events happen more slowly, the bug doesn't happen. It is like the
AE queue is getting flooded.

Adding an [appleEvent retain]; before AESendMessage also makes no
difference.

Trygve




_______________________________________________

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: 
 >Re: Hang during AESend (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: Hang during AESend
  • Next by Date: Re: Type of text field used by Xcode's "Jump to Line"?
  • Previous by thread: Re: Hang during AESend
  • Next by thread: Re: Hang during AESend
  • Index(es):
    • Date
    • Thread