- Joined
- Sep 11, 2009
- Messages
- 1
- Reaction score
- 0
- Points
- 1
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?
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?