On Nov 17, 2008, at 10:01 AM, Scott Ribe wrote:
Mounts is being used, but just not in the init function.

You have declared it as a local variable. It *cannot* be used elsewhere.

I suspect that you have also declared it as a member (attribute, property, whatever) and expect that you're assigning to that, but the local variable
will shadow that, and so there's your problem.

He may have that problem as well, but improper separation of alloc from init as explained earlier was definitely causing the symptom described. It's trivial to reproduce:

    NSMutableArray *mounts;
    NSMutableArray *bonjourServices;

    mounts = [[NSMutableArray alloc] init];
[mounts initWithContentsOfFile:@"NonexistentFile"]; // causes dealloc bonjourServices = [[NSMutableArray alloc] init]; // reuses dealloced memory

NSLog(@"mounts = [%X], bonjourServices = [%X], equal? %d", mounts, bonjourServices, mounts == bonjourServices);


This gives me:

2008-11-17 10:10:53.285 Scratch2[21580:10b] mounts = [1317D0], bonjourServices = [1317D0], equal? 1

--Andy

_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to