• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
some crash i can not explain.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

some crash i can not explain.


  • Subject: some crash i can not explain.
  • From: Sandro Noel <email@hidden>
  • Date: Mon, 23 Oct 2006 14:15:44 -0400

Greetings!
I'm learning cocoa! :)
the explaination of my problem will be as clear as i can understand it so please bear with me :)


i'm trying to fill a NSMutableArray with some custom objects
My custom calss is defined like this :

----------------------------------
@interface ADTreeViewItem : NSObject {
	// the index of the item in the list.
	int index;
	NSString *displayString;
	int refIndex;
}
-(oneway void) release;
-(void)setIndex:         (int)value;
-(void)setDisplayString: (NSString *)value;
-(void)setRefIndex:      (int)value;

-(int)getIndex;
-(NSString *)getDisplayString;
-(int)getRefIndex;
@end
----------------------------------
@implementation ADTreeViewItem
- (oneway void) release{
	[displayString release]; // i have a retain on it.
}
-(void)setIndex:(int)value{
	if (value <= 0) value = 0; // no negative index.
	index = value;
}
-(void)setDisplayString:(NSString *)value{
	// retain the string so it does not go away...
	displayString = [value retain];
}
-(void)setRefIndex:(int)value{
	refIndex = value;
}

-(int)getIndex{
return index;
}
-(NSString *)getDisplayString{
return displayString;
}
-(int)getRefIndex{
return refIndex;
}
@end
---------------------------------------
ok now, when i try to add an instance of this class to a array like this.
the compiler does not complain, but the runtime send's me to the debug
window, without any explaination, i just get a window with ASM code


another custom class holds 3 Mutable Array.
but i've cut them out for this mail... and there all init and released the same.
@implementation ADTreeViewData
//init
-(id)init{
if ((self = [super init])) {
arrayOfNames = [[NSMutableArray array] init];
}
return self;
}
// clean up
- (oneway void)release{
[arrayOfNames release];
[super release];
}


-(int)addName:(NSString *)name{
	ADTreeViewItem *item = [[ADTreeViewItem alloc]init];
	[item setDisplayString:name];
	[arrayofNames addObject:item];
	return [arrayOfNames count];
}

so , when i add the created item to the arrayOfNames i get no error but everything stops, I've checked the variables in the debug view and the array is not null...in the sence that is has been created and is not released at the point where i am trying to insert an object into it....

can anyone help out or point out what i'm doing wrong ?

thank you in advance.
Sandro.


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: some crash i can not explain.
      • From: Nick Zitzmann <email@hidden>
  • Prev by Date: Re: How to change standard user to administrator type
  • Next by Date: Re: some crash i can not explain.
  • Previous by thread: Re: How to change standard user to administrator type
  • Next by thread: Re: some crash i can not explain.
  • Index(es):
    • Date
    • Thread