Crash after weeks of doing nothing to my code
Crash after weeks of doing nothing to my code
- Subject: Crash after weeks of doing nothing to my code
- From: Adam <email@hidden>
- Date: Tue, 2 Aug 2005 21:36:20 -0400
I have an unexplained crash caused by a NSLog on an NString, however
I suspect is has something to do with the autorelease pool and an
NSData object. I have changed nothing about my code in weeks and all
of a sudden crashes with this stack:
#0 0xfffeff18 in objc_msgSend_rtp
#1 0x9286e370 in _NSDescriptionWithLocaleFunc
#2 0x90731370 in _CFStringAppendFormatAndArgumentsAux
#3 0x90730228 in _CFStringCreateWithFormatAndArgumentsAux
#4 0x928880b4 in NSLogv
#5 0x92888050 in NSLog
#6 0x002354a8 in -[AGFIBSSocketStream netsocket:dataAvailable:] at
AGFIBSSocketStream.m:245
I tried enabling NSZombieEnabled = YES; and commenting out my NSLog
and I get this:
2005-08-02 20:02:57.168 CocoaFIBS[824] *** Selector 'release' sent to
dealloced instance 0x165014c0 of class NSConcreteMutableData.
Break at '-[_NSZombie release]' to debug.
2005-08-02 20:02:57.168 CocoaFIBS[824] *** -[NSAutoreleasePool
dealloc]: Exception ignored while releasing an object in an
autorelease pool: *** Selector 'release' sent to dealloced instance
0x165014c0 of class NSConcreteMutableData.
Break at '-[_NSZombie release]' to debug.
When I create a symbolic break point at [_NSZombie release] the stack
says:
#0 0x9294ab74 in -[_NSZombie release]
#1 0x92859708 in NSPopAutoreleasePool
#2 0x9361a414 in -[NSApplication run]
#3 0x9370ac1c in NSApplicationMain
#4 0x0002ffb0 in main at main.m:20
This methods causes the crash:
- (void)netsocket:(NetSocket*)inNetSocket dataAvailable:(unsigned)
inAmount
// If the stream has bytes available to read, read it and strip the
new line chars.
{
NSString *messageString = [mSocket
readString:NSUTF8StringEncoding];
NSString *newLineChar = @"\n";
NSString *temp = nil;
NSString *carriageReturnChar = @"\r";
NSString *cookieString = nil;
NSArray *arrayToStripNewLineCharFromString = [ messageString
componentsSeparatedByString:newLineChar];
uint8_t buffer[1024];
int numberOfLinesInBuffer = [arrayToStripNewLineCharFromString
count];
int cookie = 0;
int i = 0;
int bytesRead = 0;
//Append the last line of the previous data avilible block to
the first line of this one
for (i=0; i < numberOfLinesInBuffer; i++) {
NSString *oneStringFromArray = [[NSString alloc] init];
oneStringFromArray = [arrayToStripNewLineCharFromString
objectAtIndex:i];
oneStringFromArray = [self
findAndReplaceStringInString:oneStringFromArray
find:carriageReturnChar replace:@""];
//Convert NSString to cstring
int aBufferSize = [oneStringFromArray length];
char aBuffer[aBufferSize];
NSData *cString = [[NSData alloc] initWithData:
[oneStringFromArray dataUsingEncoding:[NSString
defaultCStringEncoding]]];
[cString getBytes:aBuffer];
cookie = FIBSCookie(aBuffer);
[cString release];
[delegate handleFIBSResponseEvent:cookie
message:oneStringFromArray];
//Format a nice string to print to the terminal
cookieString = [[NSString alloc] initWithFormat:@"(%d)",
cookie];
oneStringFromArray = [cookieString
stringByAppendingString:oneStringFromArray];
NSLog(oneStringFromArray);
[oneStringFromArray release];
}
}
Anyone have a clue?
_______________________________________________
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