changeset 747:a4f99795ff26

Abort drawing functions if we fail to lock focus on a render control.
author bsmith@81767d24-ef19-dc11-ae90-00e081727c95
date Wed, 16 Mar 2011 15:10:16 +0000
parents 0a364e76a7aa
children f39745844175
files mac/dw.m
diffstat 1 files changed, 29 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- 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];