[Mono-bugs] [Bug 79343][Cri] New - Crash while leaving a menu.

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sat Sep 9 02:58:51 EDT 2006

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 miguel at ximian.com.


--- shadow/79343	2006-09-09 02:58:51.000000000 -0400
+++ shadow/79343.tmp.27536	2006-09-09 02:58:51.000000000 -0400
@@ -0,0 +1,79 @@
+Bug#: 79343
+Product: Mono: Class Libraries
+Version: unspecified
+OS Details: 
+Status: NEW   
+Priority: Critical
+Component: Windows.Forms
+AssignedTo: toshok at ximian.com                            
+ReportedBy: miguel at ximian.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: Crash while leaving a menu.
+1. Click and hold on the menu, for example in the word "Standard"
+2. Move the pointer away from the window, but keep the button held down.
+3. Release the button.
+it fails like this:
+Unhandled Exception: System.NullReferenceException: Object reference not
+set to an instance of an object
+  at System.Windows.Forms.MenuTracker.OnMouseUp
+(System.Windows.Forms.MouseEventArgs args) [0x00000] in
+  at System.Windows.Forms.Form.WndProc (System.Windows.Forms.Message& m)
+[0x0065b] in
+  at System.Windows.Forms.Control+ControlNativeWindow.WndProc
+(System.Windows.Forms.Message& m) [0x00000] in
+  at System.Windows.Forms.NativeWindow.WndProc (IntPtr hWnd, Msg msg,
+IntPtr wParam, IntPtr lParam) [0x0006b] in
+  at System.Windows.Forms.XplatUIX11.DispatchMessage
+(System.Windows.Forms.MSG& msg) [0x00000] in
+  at System.Windows.Forms.XplatUI.DispatchMessage
+(System.Windows.Forms.MSG& msg) [0x00000] in
+  at System.Windows.Forms.Application.RunLoop (Boolean Modal,
+System.Windows.Forms.ApplicationContext context) [0x0023c] in
+  at System.Windows.Forms.Application.Run (System.Windows.Forms.Form
+mainForm) [0x00000] in
+  at MyFormProject.MainForm.Main (System.String[] args) [0x00000]
+The stack trace seems busted for the first method, as thats the entry point
+I think the issue is that item is null, proposed patch:
+Index: System.Windows.Forms/MenuAPI.cs
+--- System.Windows.Forms/MenuAPI.cs     (revision 65142)
++++ System.Windows.Forms/MenuAPI.cs     (working copy)
+@@ -169,11 +169,12 @@
+                public void OnMouseUp (MouseEventArgs args)
+                {
+                        MenuItem item = GetItemAtXY (args.X, args.Y);
+-                       if (item.Parent is MainMenu)
++                       if (item != null && item.Parent is MainMenu)
+                                return;
+                        Deactivate ();
+-                       item.PerformClick ();
++                       if (item != null)
++                               item.PerformClick ();
+                }
+                void MoveSelection (MenuItem item)

More information about the mono-bugs mailing list