[Mono-bugs] [Bug 73181][Maj] New - Multithreaded Drawstring causes NullReference exception

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Tue, 1 Mar 2005 18:25:15 -0500 (EST)

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 david.mitchell@telogis.com.


--- shadow/73181	2005-03-01 18:25:15.000000000 -0500
+++ shadow/73181.tmp.21881	2005-03-01 18:25:15.000000000 -0500
@@ -0,0 +1,57 @@
+Bug#: 73181
+Product: Mono: Class Libraries
+Version: 1.1
+OS: GNU/Linux [Other]
+OS Details: 
+Status: NEW   
+Priority: Major
+Component: Sys.Drawing.
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: david.mitchell@telogis.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+Summary: Multithreaded Drawstring causes NullReference exception
+Description of Problem:
+When several threads simultaneously attempt to use drawstring (on different
+bitmaps) there is often a NullReference exceptions. Running this through
+gdb it is often a segfault occuring in the 'MeasureOrDrawString' function,
+here is a backtrace:
+#0  _cairo_gstate_set_font (gstate=0x8343838, font=0x17) at cairo_gstate.c:2380
+#1  0xb7564bb8 in cairo_set_font (cr=0x82cf940, font=0x1) at cairo.c:879
+#2  0xb753ae68 in MeasureOrDrawString (graphics=0x8330cc0,
+    stringUnicode=0x8269f84, length=11, font=0x8330ba8, rc=0xb78052f4,
+    format=0x0, brush=0x8343710, boundingBox=0x0, codepointsFitted=0x0,
+    linesFilled=0x0, draw=1) at graphics.c:1758
+#3  0xb753c8be in GdipDrawString (graphics=0x1, stringUnicode=0x1,
+    length=-1220505088, font=0x1, rc=0x1, fmt=0x1, brush=0x1)
+    at graphics.c:2443
+#4  0xb7b0fe9f in ?? ()
+#5  0x08330cc0 in ?? ()
+#6  0x08269f84 in ?? ()
+#7  0x0000000b in ?? ()
+Steps to reproduce the problem:
+1. Compile the attached program with mcs -r System.Drawing charter.cs
+2. Run charter like so: charter.exe 10
+3. Run it several times
+Actual Results:
+Sometimes it throws one or more NullReference exceptions, sometimes after
+these exceptions it doesn't exit
+Expected Results:
+Runs to completion and exits without any output
+How often does this happen? 
+Frequently, but not every time.
+Additional Information:
+Sample attached