Bug 397209 - Catch ObjC exception when trying to draw to an offscreen buffer. r=josh sr=vlad a1.9=vlad

This commit is contained in:
cbarrett@mozilla.com 2007-10-05 14:24:01 -07:00
parent 72fe490130
commit 9f3cde2e41

View File

@ -189,7 +189,13 @@ nsNativeThemeCocoa::DrawButton(CGContextRef cgContext, ThemeButtonKind inKind,
drawFrame.size.height = offscreenHeight - NATIVE_PUSH_BUTTON_HEIGHT_DIFF;
// draw into offscreen image
[image lockFocus];
NS_DURING
[image lockFocus];
NS_HANDLER
NS_ASSERTION(0, "Could not lock focus on offscreen buffer");
[image release];
return;
NS_ENDHANDLER
[[NSGraphicsContext currentContext] setImageInterpolation:NSImageInterpolationLow];
HIThemeDrawButton(&drawFrame, &bdi, (CGContext*)[[NSGraphicsContext currentContext] graphicsPort], kHIThemeOrientationInverted, NULL);
[image unlockFocus];