10.4-only top crash at [@ nsNativeThemeCocoa::DrawCellWithScaling]. b=458961 r=mstange,stuart.morgan sr=vlad a=vlad

This commit is contained in:
Steven Michaud 2008-11-09 16:30:46 -06:00
Родитель 800ca5417b
Коммит c0a29b5c2a
1 изменённых файлов: 8 добавлений и 5 удалений

Просмотреть файл

@ -256,8 +256,7 @@ static void DrawCellWithScaling(NSCell *cell,
if (drawRect.size.height < minimumSize.height)
drawRect.size.height = minimumSize.height;
CGAffineTransform savedCTM = CGContextGetCTM(cgContext);
NSGraphicsContext* savedContext = [NSGraphicsContext currentContext];
[NSGraphicsContext saveGraphicsState];
if (flip) {
// This flips the image in place and is necessary to work around a bug in the way
@ -274,12 +273,16 @@ static void DrawCellWithScaling(NSCell *cell,
// Inflate the rect Gecko gave us by the margin for the control.
InflateControlRect(&drawRect, controlSize, marginSet);
NSGraphicsContext* savedContext = [NSGraphicsContext currentContext];
// Set up the graphics context we've been asked to draw to.
[NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithGraphicsPort:cgContext flipped:YES]];
// [NSView focusView] may return nil here, but
// [NSCell drawWithFrame:inView:] can deal with that.
[cell drawWithFrame:drawRect inView:[NSView focusView]];
[NSGraphicsContext setCurrentContext:savedContext];
}
else {
float w = ceil(drawRect.size.width);
@ -303,6 +306,8 @@ static void DrawCellWithScaling(NSCell *cell,
CGContextTranslateCTM(ctx, MAX_FOCUS_RING_WIDTH, MAX_FOCUS_RING_WIDTH);
NSGraphicsContext* savedContext = [NSGraphicsContext currentContext];
[NSGraphicsContext setCurrentContext:[NSGraphicsContext graphicsContextWithGraphicsPort:ctx flipped:YES]];
// [NSView focusView] may return nil here, but
@ -330,9 +335,7 @@ static void DrawCellWithScaling(NSCell *cell,
CGContextRelease(ctx);
}
CGContextSetCTM(cgContext, savedCTM);
[NSGraphicsContext setCurrentContext:savedContext];
[NSGraphicsContext restoreGraphicsState];
#if DRAW_IN_FRAME_DEBUG
CGContextSetRGBFillColor(cgContext, 0.0, 0.0, 0.5, 0.25);