Thanks a lot, that did it.

Daniel

On Dec 21, 6:45 pm, "ted bonkenburg" <[EMAIL PROTECTED]> wrote:
> Hi Daniel,
>
> See comments inline.
>
> On Dec 21, 2007 3:37 AM, dakl <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > Hi all,
>
> > I am building using macfuse to create a filesystem that displays bt-
> > devices as folder. Here's my header:
>
> > @interface HelloFuseFileSystem : FUSEFileSystem{
> >        BlueLister * lister;
> >        BOOL hasFoundDevices;
> >        NSDictionary * myDevices;
> > }
>
> > - (HelloFuseFileSystem *) init;
> > - (void) foundDeviceDictionary;
> > - (void) printDeviceDictionary;
> > - (NSArray *) rootContents;
>
> > - (IBAction) findDevices:(id) sender;
>
> > @end
>
> > As you can tell, I am building it on top of the HelloFuse example from
> > Google.
>
> > However, I am having some trouble with the myDevices-variable. I am
> > setting it to a default value in my init (for testing purposes) like
> > so:
>
> > - (HelloFuseFileSystem *) init {
> >        self = [super init];
> >        // set defaults
> >        hasFoundDevices = NO;
>
> >        NSArray *       addresses       = [NSArray
> > arrayWithObjects:@"00-00-00-11-00",
> > @"aa-ee-aa-ff-aa", nil];
> >        NSArray *       names           = [NSArray
> > arrayWithObjects:@"Device 1", @"Device
> > 2", nil];
> >        myDevices = [NSDictionary dictionaryWithObjects:addresses
> > forKeys:names];
>
> I think these calls are creating objects that are autoreleased.  In init you
> should be retaining anything you'd like to keep for the lifetime of the
> object.  You should probably also release them in dealloc as well.
>
> The arrays might be fine to keep as-is since the dictionary should retain
> whatever you put in it.  The dictionary might go away when the autorelease
> pool is cleaned up.  Try changing to:
>
> myDevices = [[NSDictionary alloc] initWithObjects:addressess forKeys:names];
>
> instead.  Also add a:
>
> - (void)dealloc {
>   [myDevices release];
>   [super dealloc];
>
> }
>
>  and let me know if that fixes your problem.
>
> ted
>
>
>
> >        [self printDeviceDictionary];
> >        return self;
> > }
>
> > As you can see, I'm also printing its contents using my
> > printDeviceDictionary. So far everthing works exellent. In my
> > implementation of contentsOfDirectoryAtPath, I start out by printing
> > the device dictionary again. This time, the debugger comes up, saying
>
> > 0x90a59380  <+0016>  mov    0x20(%eax),%eax
>
> > I have been able to pinpoint the issue to the exact row in
> > printDeviceDictionary where I'm trying to access myDevices, but I
> > don't understand the error. I'm on Mac OS X 10.4.11 using XCode 2.5
>
> > - (void) printDeviceDictionary {
> >        NSLog(@"Printing device dictionary\n");
> >        id key;
> >        NSEnumerator * enumerator = [myDevices keyEnumerator];
>
> >        NSLog(@"Printing device dictionary 2\n");
> >        while ((key = [enumerator nextObject])) {
> >                NSLog(@"%@ : %@", key, [myDevices objectForKey:key]);
> >        }
> >        NSLog(@"Done.\n");
> > }
>
> > Does anyone have any ideas on why my supposedly global variable
> > myDevices "disappears"?
>
> > Best
> > Daniel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"macfuse-devel" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/macfuse-devel?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to