# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1300288216 0 # Node ID a4f99795ff261186adfd65d45c6d26e90ce92a8f # Parent 0a364e76a7aa980d4c5e0ae5d132a75c794f875e Abort drawing functions if we fail to lock focus on a render control. diff -r 0a364e76a7aa -r a4f99795ff26 mac/dw.m --- a/mac/dw.m Wed Mar 16 07:44:35 2011 +0000 +++ b/mac/dw.m Wed Mar 16 15:10:16 2011 +0000 @@ -390,7 +390,10 @@ } else { - [bltdest lockFocusIfCanDraw]; + if([bltdest lockFocusIfCanDraw] == NO) + { + return; + } _DWLastDrawable = bltinfo->dest; } if([bltsrc isMemberOfClass:[NSImage class]]) @@ -3753,7 +3756,11 @@ } else { - [image lockFocusIfCanDraw]; + if([image lockFocusIfCanDraw] == NO) + { + DW_MUTEX_UNLOCK; + return; + } _DWLastDrawable = handle; } NSBezierPath* aPath = [NSBezierPath bezierPath]; @@ -3788,7 +3795,11 @@ } else { - [image lockFocusIfCanDraw]; + if([image lockFocusIfCanDraw] == NO) + { + DW_MUTEX_UNLOCK; + return; + } _DWLastDrawable = handle; } NSBezierPath* aPath = [NSBezierPath bezierPath]; @@ -3824,7 +3835,11 @@ { DWRender *render = handle; NSFont *font = [render font]; - [image lockFocusIfCanDraw]; + if([image lockFocusIfCanDraw] == NO) + { + DW_MUTEX_UNLOCK; + return; + } NSColor *color = [NSColor colorWithDeviceRed: DW_RED_VALUE(_foreground)/255.0 green: DW_GREEN_VALUE(_foreground)/255.0 blue: DW_BLUE_VALUE(_foreground)/255.0 alpha: 1]; NSMutableDictionary *dict = [[NSMutableDictionary alloc] initWithObjectsAndKeys:color, NSForegroundColorAttributeName, nil]; if(font) @@ -3921,7 +3936,11 @@ } else { - [image lockFocusIfCanDraw]; + if([image lockFocusIfCanDraw] == NO) + { + DW_MUTEX_UNLOCK; + return; + } _DWLastDrawable = handle; } NSBezierPath* aPath = [NSBezierPath bezierPath]; @@ -3966,7 +3985,11 @@ } else { - [image lockFocusIfCanDraw]; + if([image lockFocusIfCanDraw] == NO) + { + DW_MUTEX_UNLOCK; + return; + } _DWLastDrawable = handle; } NSBezierPath* aPath = [NSBezierPath bezierPath];