[Mono-bugs] [Bug 80415][Maj] New - [PATCH] Form.Closing event cannot be canceld for non modal forms

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Sun Dec 31 05:36:31 EST 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 domseichter at web.de.

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

--- shadow/80415	2006-12-31 05:36:31.000000000 -0500
+++ shadow/80415.tmp.9050	2006-12-31 05:36:31.000000000 -0500
@@ -0,0 +1,68 @@
+Bug#: 80415
+Product: Mono: Class Libraries
+Version: 1.2
+OS: 
+OS Details: Kubuntu Linux Amd64
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Major
+Component: Windows.Forms
+AssignedTo: toshok at ximian.com                            
+ReportedBy: domseichter at web.de               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: [PATCH] Form.Closing event cannot be canceld for non modal forms
+
+Description of Problem:
+
+The behaviour of the Form.Closing event for not modal forms is incorrect. 
+The cancel event cannot be canceled for non modal forms. Under .NET CLR 
+the cancel event can be canceled for non modal forms.
+
+That attached patch fixes the problem
+
+
+Steps to reproduce the problem:
+1. Create a form and register a CancelEventHandler to the Form.Closing 
+event
+2. in the event handler cancel the CancelEventArg e: e.Cancel = true
+3. Open the form and try to close it with a click on the X in the 
+titlebar. -> The form is still closed, the event is not canceled.
+
+Actual Results:
+The event is not canceled, the form is closed.
+
+Expected Results:
+The event should be canceled, the form should stay open.
+
+
+How often does this happen? 
+Alyways.
+
+Additional Information:
+
+The bug is fixed by the attached patch against the latest SVN trunk. The 
+patch has to be applied to the file Form.cs in the directory 
+mcs/class/Managed.Windows.Forms/System.Windows.Forms .
+
+
+Index: Form.cs
+===================================================================
+--- Form.cs     (Revision 70224)
++++ Form.cs     (Arbeitskopie)
+@@ -1879,8 +1879,10 @@
+                                                if (!args.Cancel) {
+                                                        OnClosed 
+(EventArgs.Empty);
+                                                        closing = true;
++                                                       Dispose ();
++                                               } else {
++                                                       closing = false;
+                                                }
+-                                               Dispose ();
+                                        } else {
+                                                OnClosing (args);
+                                                if (args.Cancel) {


More information about the mono-bugs mailing list