[Mono-bugs] [Bug 76326][Maj] New - Sometimes Windows Forms get a Null Pointer Exception

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Mon Oct 3 19:05:15 EDT 2005


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 carlos at applianz.com.

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

--- shadow/76326	2005-10-03 19:05:15.000000000 -0400
+++ shadow/76326.tmp.8266	2005-10-03 19:05:15.000000000 -0400
@@ -0,0 +1,67 @@
+Bug#: 76326
+Product: Mono: Class Libraries
+Version: 1.1
+OS: 
+OS Details: Gentoo 64bit
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: Windows.Forms
+AssignedTo: peter at novonyx.com                            
+ReportedBy: carlos at applianz.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: Sometimes Windows Forms get a Null Pointer Exception 
+
+Sometimes while running windows forms I get the exception pasted below. It
+almost looks like a timming issue because changing some of my code to delay
+certain actions can make the error not ocurr. It happens almost every time
+I run my code but not every time which also leads me to believe its a
+timming thing. 
+The error I am pretty sure didn't happen before I install 1.1.9.1, it
+seemed to work fine on 1.1.9, the only other difference is that before I
+was using Gentoo 32bit, now I am using it on 64bit.
+
+I have narrowed the problem down to the Marshal line almost at the end of
+this code I am copying, I am going to see if I can fix it and will add
+anything else I find to this bug report:
+
+internal override IntPtr GetActive() {
+                        Atom    actual_atom;
+                        int     actual_format;
+                        int     nitems;
+                        int     bytes_after;
+                        IntPtr  prop = IntPtr.Zero;
+                        IntPtr  active = IntPtr.Zero;
+                             
+                        XGetWindowProperty(DisplayHandle, RootWindow,
+NetAtoms[(int)NA._NET_ACTIVE_WINDOW], 0, 1, false, Atom.XA_WINDOW, out
+actual_atom, out actual_format, out nitems, out bytes_after, ref prop);
+                             
+                        if ((nitems > 0) && (prop != IntPtr.Zero)) {
+                               active = (IntPtr)Marshal.ReadInt32(prop);
+                                XFree(prop);
+                        }
+
+
+
+Here is the exception I get:
+System.NullReferenceException: Object reference not set to an instance of
+an object
+in <0x00000> <unknown method>
+in (wrapper managed-to-native)
+System.Runtime.InteropServices.Marshal:ReadInt32 (intptr,int)
+in <0x00017> System.Runtime.InteropServices.Marshal:ReadInt32 (IntPtr ptr)
+in <0x0016a> System.Windows.Forms.XplatUIX11:GetActive ()
+in <0x0001c> System.Windows.Forms.XplatUI:GetActive ()
+in <0x00020> System.Windows.Forms.Form:get_ActiveForm ()
+in <0x00012> System.Windows.Forms.Form:Activate ()
+in (wrapper remoting-invoke-with-check) System.Windows.Forms.Form:Activate ()
+in <0x000d2> System.Windows.Forms.Application:Run ()
+in <0x000e7> System.Windows.Forms.Application:Run
+(System.Windows.Forms.ApplicationContext context)
+in <0x0003b> System.Windows.Forms.Application:Run
+(System.Windows.Forms.Form mainForm)


More information about the mono-bugs mailing list