Weird bug in my code [long]
Weird bug in my code [long]
- Subject: Weird bug in my code [long]
- From: Robert Cerny <email@hidden>
- Date: Sun, 22 Feb 2004 11:40:24 +0100
Hi folks,
I have got a pretty weird bug in my code, which I'm unable to find. The
situation is as follows: I have a window, which is loaded from another
nib than MainMenu.nib The Nib owner of my object is FMDelegate. The
window contains a NSOutlineView, which should display all font families
active in system.
The bug is that sometimes the outline displays empty. I used a few
dozens of NSAsserts to find the problematic place but didn't find
anything. I added a button to window, which is used just for invoking
debuger and using this technique I was able to stop in problematic
case. (the problem doesn't show always) To my suprise, the pointers to
window objects - created in IB - were empty!? It leads me to idea that
I somehow harm the initialization process but I have no idea what's
wrong. Let me show you some code:
Engine is a pointer to FMEngine object, which is a datasource for
outline view.
FMDelegate.m
- (void)awakeFromNib
{
[self showFontList:nil];
}
- (IBAction)showFontList:(id)sender
{
if (!fontListController)
{
[NSBundle loadNibNamed:@"FontList" owner:self];
}
[fontListController showWindow:[fontListController window]];
}
FMFontListController.m
- (id)init
{
if (self == [super init])
{
engine = [[(FMDelegate*)[NSApp delegate] engine] retain];
return self;
}
return nil;
}
- (void)awakeFromNib
{
[self setupOutline];
[self setupNotifications];
}
FMEngine.m
- (void)setupOutline
{
[outlineView setDelegate:engine];
[outlineView setDataSource:engine];
[outlineView setDoubleAction:@selector(displayFontProperties:)];
}
Thanks
Robert
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.