Hi Andreas,

Sorry about the TP. I only wanted to hit one item.

> So, I suspect the error is elsewhere, it may be "thread-related" if
> you do such things - but it's most likely still in your code  ;)
You were right - a simple 'Hello World' worked as expected. I'll have
to look for the issue in other places. I'm not threading at this
point, which leads me to beliew I've got a problem with my view stack.

Thanks for taking the time.

Jeff

On Fri, Mar 11, 2011 at 4:27 AM, Andreas Grosam <agro...@onlinehome.de> wrote:
>
> On Mar 10, 2011, at 1:33 AM, Jeffrey Walton wrote:
>
>> Hi All,
>>
>> I've got a method that refreshes a list of files in a directory. The
>> code executes properly on the first invocation, but crashes on the
>> second invocation. The cause of the crash is walker = [fileManager
>> enumeratorAtPath:directory].
>>
>> Any ideas on the cause? I experience the crash with both methods of
>> retrieving the file manager. Are there known issues with
>> enumeratorAtPath?
>
> Form the snipped below, I cannot see a memory management error. It doesn't 
> mean, there is none, though. The object 'walker' *should* be valid unless you 
> access it *after* you released 'fileManager'.
>
> It not at all looks like a concurrency issue or race condition related 
> problem stemming from the framework. If there is an issue in the framework, 
> it may only happen when you simultaneously alter the contents of the 
> directory in a different thread while you iterating through it in your code.
>
> So, I suspect the error is elsewhere, it may be "thread-related" if you do 
> such things - but it's most likely still in your code  ;)
>
> Nonetheless, after you carefully reviewed your code, and couldn't find the 
> error I would resort to check a thread-safety related issue within Cocoa as 
> well.
>
>
> Andreas
>
>>
>> Jeff
>>
>>    NSString* directory = nil;
>>    NSFileManager* fileManager = nil;
>>    NSDirectoryEnumerator* walker = nil
>>
>>    directory = [NSHomeDirectory() 
>> stringByAppendingPathComponent:@"Documents"];
>>    if(directory == nil)
>>        /* handle error and exit */
>>
>>    // fileManager = [NSFileManager defaultManager];
>>    fileManager = [[NSFileManager alloc] init];
>>    if(fileManager == nil)
>>        /* handle error and exit */
>>
>>    walker = [fileManager enumeratorAtPath:directory];
>>    if(walker == nil)
>>        /* handle error and exit */
>>
>>    NSString* file = nil;
>>    while((file = [walker nextObject]) != nil)
>>    {
>>        BOOL isDirectory = YES;
>>        if([fileManager fileExistsAtPath:file
>> isDirectory:&isDirectory] && !isDirectory)
>>            [files addObject:file];
>>    }
>>
>>    ...
>>
>>    [fileManager release];
>>
>> *****
>>
>> According to 'NSFileManager Class Reference'
>> (http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/Foundation/Classes/NSFileManager_Class/Reference/Reference.html):
>>
>>    In iOS and Mac OS X v 10.5 and later you should consider
>>    using [[NSFileManager alloc] init] rather than the singleton
>>    method defaultManager. Instances of NSFileManager are
>>    considered thread-safe when created using
>>    [[NSFileManager alloc] init].
>> _______________________________________________
>>
>> 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/agrosam%40onlinehome.de
>>
>> This email sent to agro...@onlinehome.de
>
> _______________________________________________
>
> 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/noloader%40gmail.com
>
> This email sent to noloa...@gmail.com
>
_______________________________________________

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 arch...@mail-archive.com

Reply via email to