Re: “EXC_BAD_ACCESS” object is not nil but not accessible
Re: “EXC_BAD_ACCESS” object is not nil but not accessible
- Subject: Re: “EXC_BAD_ACCESS” object is not nil but not accessible
- From: Marco Frisan <email@hidden>
- Date: Mon, 17 Jan 2011 01:48:08 +0100
Il giorno 16/gen/2011, alle ore 19.06, Kyle Sluder ha scritto:
> On Jan 15, 2011, at 3:55 AM, Marco Frisan <email@hidden> wrote:
>
>> I don't understand why _record.attributes causes a “EXC_BAD_ACCESS” signal.
>
> This is the defining characteristic of a memory management bug: you have a pointer to an object that has since been freed. Trying to use that pointer is an error.
>
> --Kyle Sluder
Yes I know that. The problem is that I am was not able to find which pointer. And the reason I am not able to find it is that the line that cause the application block is:
NSDictionary * attributes = _record.attributes;
inside the numberOfRowsInTableView: method of my custom class VLVolumeDetailsViewController.
I checked with debugger and _record, that points to a VLDiskItemRecord object, is not nil.
attributes should be not nil too and are retained by the object pointed by _record when they are initialized.
Though it seems that I resolved it using initWithDictionary:copyItems: and passing YES as its second parameter, to create a copy of the attributes dictionary, instead of simply retain the one returned by attributesOfItemAtPath:error:. Though I do not understand yet which was the object freed in the previous approach.
--Marco Frisan
_______________________________________________
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