Author: gnorton
Date: 2008-01-23 15:02:04 -0500 (Wed, 23 Jan 2008)
New Revision: 93700

Modified:
   trunk/mcs/class/System.Drawing/System.Drawing/ChangeLog
   trunk/mcs/class/System.Drawing/System.Drawing/carbonFunctions.cs
Log:
In System.Drawing:
        * carbonFunctions.cs: Dont crash when we have an orphaned handle.

2008-01-23  Geoff Norton  <[EMAIL PROTECTED]>



Modified: trunk/mcs/class/System.Drawing/System.Drawing/ChangeLog
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing/ChangeLog     2008-01-23 
20:01:07 UTC (rev 93699)
+++ trunk/mcs/class/System.Drawing/System.Drawing/ChangeLog     2008-01-23 
20:02:04 UTC (rev 93700)
@@ -1,5 +1,9 @@
 2008-01-23  Geoff Norton  <[EMAIL PROTECTED]>
 
+       * carbonFunctions.cs: Dont crash when we have an orphaned handle.
+
+2008-01-23  Geoff Norton  <[EMAIL PROTECTED]>
+
        * carbonFunctions.cs: If we get a -ve size from carbon, swizzle to 
        0 to prevent a OOM from cairo malloc.  Remove support for
        GetCGContextForNSView as its deprecated and doesn't work.

Modified: trunk/mcs/class/System.Drawing/System.Drawing/carbonFunctions.cs
===================================================================
--- trunk/mcs/class/System.Drawing/System.Drawing/carbonFunctions.cs    
2008-01-23 20:01:07 UTC (rev 93699)
+++ trunk/mcs/class/System.Drawing/System.Drawing/carbonFunctions.cs    
2008-01-23 20:02:04 UTC (rev 93700)
@@ -56,7 +56,9 @@
                        IntPtr port = IntPtr.Zero;
                        IntPtr window = IntPtr.Zero;
 
-                       if (handle == IntPtr.Zero) {
+                       window = GetControlOwner (handle);
+
+                       if (handle == IntPtr.Zero || window == IntPtr.Zero) {
                                // FIXME: Can we actually get a CGContextRef 
for the desktop?  this makes context IntPtr.Zero
                                port = GetQDGlobalsThePort ();
                                CreateCGContextForPort (port, ref context);
@@ -69,7 +71,6 @@
                        QDRect window_bounds = new QDRect ();
                        Rect view_bounds = new Rect ();
 
-                       window = GetControlOwner (handle);
                        port = GetWindowPort (window);
                        
                        context = GetContext (port);
@@ -114,6 +115,7 @@
                internal static IntPtr GetContext (IntPtr port) {
                        IntPtr context = IntPtr.Zero;
 
+Console.WriteLine ("GetContext for port: {0}", port);
                        lock (lockobj) { 
                                if (contextReference [port] != null) {
                                        CreateCGContextForPort (port, ref 
context);

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to