Re: How to safely delete a WebView delegate object?
Re: How to safely delete a WebView delegate object?
- Subject: Re: How to safely delete a WebView delegate object?
- From: Juanjo Conti <email@hidden>
- Date: Wed, 15 Apr 2015 10:34:19 -0300
Thanks you very much! That fixed it!
On Tue, Apr 14, 2015 at 9:44 PM, Quincey Morris <
email@hidden> wrote:
> On Apr 14, 2015, at 17:01 , Juanjo Conti <email@hidden> wrote:
> >
> > If I click the button too many times, fast enough, my app crash with a
> > EXEC_ error and if I enable zombie objects I get that it crash when one
> of
> > this two messages is been send:
> >
> > [MyDelegate respondsToSelector] or [MyDelegate retain]
> >
> > Does this smell? Any tip I should have in mind for situations like this?
>
> It smells of a memory management error. Delegates are, in most of the
> modern Cocoa classes, unretained objects, and your array (with its strong
> references to your delegates) is what’s keeping them alive. When you remove
> the array element, the strong reference disappears, and your delegate can
> get deallocated, leading to such crashes.
>
> You should make sure you’re setting the various delegate properties in the
> WebView to nil before removing the array element. (It’s too late to do it
> after, unless you’ve taken a local strong reference to the delegate before
> removing.)
>
> At least, this is what it sounds like.
>
>
--
Juanjo Conti <jjconti <http://goog_2023646312>@carouselapps.com
<email@hidden>>
Software Engineer - Carousel Apps <https://carouselapps.com>
--
Carousel Apps Limited, registered in England & Wales with registered number
7689440 and registered office Unit 2 Artbrand Studios, 7 Leathermarket
Street, London SE1 3HN. Any communication sent by or on behalf of Carousel
App Ltd or any of its subsidiary, holding or affiliated companies or
entities (together "Watu") is confidential and may be privileged or
otherwise protected. If you receive it in error please inform us and then
delete it from your system. You should not copy it or disclose its contents
to anyone. Messages sent to and from Watu may be monitored to ensure
compliance with our internal policies and to protect our business. Emails
are not secure and cannot be guaranteed to be error free. Anyone who
communicates with us by email is taken to accept these risks.
_______________________________________________
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