NSDrawNinePartImage autorelease problem
NSDrawNinePartImage autorelease problem
- Subject: NSDrawNinePartImage autorelease problem
- From: Richard <email@hidden>
- Date: Tue, 19 Jan 2010 09:51:36 +0000
hello list
i have written a chat client as part of an app i am developing that
uses a subclassed NSTextView to draw bubbles around messages, in the
iChat style. this works well for me and a few hundred other users,
except for one who reports that any time a message is entered the
application crashes. the top of the crash report is below:
OS Version: Mac OS X 10.5.7 (9J61)
Exception Type: EXC_BAD_INSTRUCTION (SIGILL)
Exception Codes: 0x0000000000000001, 0x0000000000000000
Crashed Thread: 0
Application Specific Information:
objc[79810]: FREED(id): message autorelease sent to freed object=0x15fa3250
Thread 0 Crashed:
0 libobjc.A.dylib 0x9068fbfa _objc_error + 116
1 libobjc.A.dylib 0x9068fc30 __objc_error + 52
2 libobjc.A.dylib 0x9068e637 _freedHandler + 58
3 com.apple.AppKit 0x92cd7c83 _NSTileImageWithOperation + 2061
4 com.apple.AppKit 0x92cf4902 _NSDrawNinePartImage + 1128
5 com.apple.AppKit 0x92f26f2c NSDrawNinePartImage + 575
6 com.bdp.iSoul 0x0002ff61 -[BubbleTextView
drawBubbleAroundTextInRect:user:outgoing:] + 1913
7 com.bdp.iSoul 0x0003097d -[BubbleTextView
drawViewBackgroundInRect:] + 1322
i am not sure how to go about fixing this, can anyone suggest where
the autorelease message is sent? the tiled bubble images are held in
NSArrays and the bubble drawing code in BubbleTextView is shown below.
i cannot understand why the error would occur for this user
particularly, can anyone see something wrong with the code?
- (void)drawBubbleAroundTextInRect:(NSRect)rect user:(User *)user
outgoing:(BOOL)outgoing
{
NSArray *balloon;
NSAffineTransform *aft = [NSAffineTransform transform];
if (outgoing) {
balloon = blueBalloon;
// if outgoing, flip the co-ordinates for the balloon
[aft scaleXBy:-1 yBy:1];
[aft translateXBy:-(2 * rect.origin.x + rect.size.width) yBy:0];
[aft concat];
} else {
...
}
// adjust the paragraph rectangle to contain the balloon
NSRect balloonRect = NSMakeRect(rect.origin.x - kBalloonPadLeft,
rect.origin.y - kBalloonPadTop,
rect.size.width + kBalloonPadLeft + kBalloonPadRight,
rect.size.height + kBalloonPadTop + kBalloonPadBottom);
NSDrawNinePartImage(balloonRect,
[balloon objectAtIndex:0],
[balloon objectAtIndex:1],
[balloon objectAtIndex:2],
[balloon objectAtIndex:3],
[balloon objectAtIndex:4],
[balloon objectAtIndex:5],
[balloon objectAtIndex:6],
[balloon objectAtIndex:7],
[balloon objectAtIndex:8],
NSCompositeSourceOver, 1.0, YES);
}
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden