[Mono-bugs] [Bug 61414][Nor] New - System.Drawing.Graphics.DrawString crash

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Sun, 11 Jul 2004 17:50:48 -0400 (EDT)


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 cleonard@go.ro.

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

--- shadow/61414	2004-07-11 17:50:48.000000000 -0400
+++ shadow/61414.tmp.14441	2004-07-11 17:50:48.000000000 -0400
@@ -0,0 +1,57 @@
+Bug#: 61414
+Product: Mono: Class Libraries
+Version: unspecified
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Sys.Drawing.
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: cleonard@go.ro               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: System.Drawing.Graphics.DrawString crash
+
+I get a crash on this sample code below, at the SECOND DrawString.
+
+using System;
+using System.Drawing;
+
+public class Font
+{
+    public static void Main()
+    {
+        Bitmap bmp = new Bitmap(256, 256);
+        Graphics graph = Graphics.FromImage(bmp);
+        System.Drawing.Font font = new System.Drawing.Font("Mono", 10);
+        SolidBrush brush = new SolidBrush(Color.White);
+
+        graph.DrawString("ZZZZ", font, brush, 0, 0);
+        Console.WriteLine("Printed once");
+        graph.DrawString("ZZZZ", font, brush, 0, 1);
+        Console.WriteLine("Printed twice");
+    }
+}
+
+The here is the console output:
+
+Printed once
+
+Unhandled Exception: System.NullReferenceException: Object reference not
+set to an instance of an object
+in (unmanaged) (wrapper managed-to-native)
+System.Drawing.GDIPlus:GdipDrawString
+(intptr,string,int,intptr,System.Drawing.RectangleF&,intptr,intptr)
+in <0x00004> (wrapper managed-to-native)
+System.Drawing.GDIPlus:GdipDrawString
+(intptr,string,int,intptr,System.Drawing.RectangleF&,intptr,intptr)
+in <0x000a3> System.Drawing.Graphics:DrawString
+(string,System.Drawing.Font,System.Drawing.Brush,single,single)
+in <0x000be> (wrapper remoting-invoke-with-check)
+System.Drawing.Graphics:DrawString
+(string,System.Drawing.Font,System.Drawing.Brush,single,single)
+in <0x00125> Font:Main ()