[Mono-bugs] [Bug 80956][Nor] Changed - [2.0] SIGSEGV in Region.ReleaseHrgn

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sun Feb 25 22:14:05 EST 2007


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by sebastien at ximian.com.

http://bugzilla.ximian.com/show_bug.cgi?id=80956

--- shadow/80956	2007-02-25 21:40:33.000000000 -0500
+++ shadow/80956.tmp.30083	2007-02-25 22:14:05.000000000 -0500
@@ -78,6 +78,55 @@
 Created an attachment (id=18775)
 Repro
 
 
 ------- Additional Comments From sebastien at ximian.com  2007-02-25 21:40 -------
 when supplying a stack trace please run "mono --debug"
+
+------- Additional Comments From sebastien at ximian.com  2007-02-25 22:14 -------
+It's a native/virtual handle mismatch (so that GDI object types have
+some "meaning" when used outside Windows). I can't try it tonight
+(anyway I won't commit it until I write some unit tests) but let me
+know the results if you try it before me.
+
+Index: gdipFunctions.cs
+===================================================================
+--- gdipFunctions.cs    (revision 73361)
++++ gdipFunctions.cs    (working copy)
+@@ -1451,7 +1451,8 @@
+                internal static extern IntPtr CreateIconIndirect ([In]
+ref IconInfo piconinfo);
+                [DllImport("user32.dll", CallingConvention =
+CallingConvention.StdCall, SetLastError=true)]
+                internal static extern bool DestroyIcon (IntPtr hIcon);
+-
++               [DllImport("gdi32.dll")]
++               internal static extern bool DeleteObject (IntPtr hObject);
+                [DllImport("user32.dll")]
+                internal static extern IntPtr GetDesktopWindow ();
+
+Index: Region.cs
+===================================================================
+--- Region.cs   (revision 73361)
++++ Region.cs   (working copy)
+@@ -648,7 +648,15 @@
+                        if (regionHandle == IntPtr.Zero)
+                                throw new ArgumentNullException
+("regionHandle");
+
+-                       Status status = GDIPlus.GdipDeleteRegion
+(regionHandle);
++                       Status status = Status.Ok;
++                       if (GDIPlus.RunningOnUnix ()) {
++                               // for libgdiplus HRGN == GpRegion*
++                               status = GDIPlus.GdipDeleteRegion
+(regionHandle);
++                       } else {
++                               // ... but on Windows HRGN are (old)
+GDI objects
++                               if (!GDIPlus.DeleteObject (regionHandle))
++                                       status = InvalidParameter;
++                       }
+                        GDIPlus.CheckStatus (status);
+                }
+ #endif
+


More information about the mono-bugs mailing list