View Single Post
fontdesigner

 
Member Since: Sep 11, 2009
Posts: 1
fontdesigner is on a distinguished road

fontdesigner is offline
Could somebody help me?

I declared NSMutableArray in header file like this:
TPEditGlyphView.h:

@interface TPEditGlyphView : NSView
{
...
NSMutableArray * observedKnots;
....
}

Next I try to use one, but any access makes "EXC_BAD_ACCESS"..

TPEditGlyphView.m:
//only places where observedKnots appears
.....
-(void) awakeFromNib
{
.....
observedKnots = [NSMutableArray arrayWithCapacity:0]; //CRASH, EXPLOSION...
}

-(void) observeValueForKeyPath: keyPath ofObject: object change: change context:context {
if (context == TPKnotsSelectionDidChangedContext) {
for (TPKnot *knot in observedKnots) { //CRASH, EXPLOSION...
....
}
observedKnots = [NSMutableArray arrayWithCapacity:0];
for (TPKnot *knot in [knotsController selectedObjects]) {
....
[observedKnots addObject: knot];
....
}
}
....

Where could be bug?
QUOTE Thanks