Author: toshok
Date: 2006-11-15 19:53:11 -0500 (Wed, 15 Nov 2006)
New Revision: 67966
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ApplicationContext.cs
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
Log:
2006-11-15 Chris Toshok <[EMAIL PROTECTED]>
* Form.cs (set_Owner): allow a null value so we can clear the
form's owner.
(Dispose): set all our owned_form's Owner properties to null, and
clear the owned_forms collection.
(WM_CLOSE): clean up this a little bit.. still not right though.
* ApplicationContext.cs: OnMainFormClosed should only call
ExitThreadCore if the main form isn't recreating. Fixes unit
test.
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ApplicationContext.cs
===================================================================
---
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ApplicationContext.cs
2006-11-16 00:51:58 UTC (rev 67965)
+++
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ApplicationContext.cs
2006-11-16 00:53:11 UTC (rev 67966)
@@ -89,7 +89,8 @@
}
protected virtual void OnMainFormClosed(object sender,
EventArgs e) {
- ExitThreadCore();
+ if (!MainForm.RecreatingHandle)
+ ExitThreadCore();
}
#endregion // Public Instance Methods
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2006-11-16 00:51:58 UTC (rev 67965)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2006-11-16 00:53:11 UTC (rev 67966)
@@ -1,3 +1,15 @@
+2006-11-15 Chris Toshok <[EMAIL PROTECTED]>
+
+ * Form.cs (set_Owner): allow a null value so we can clear the
+ form's owner.
+ (Dispose): set all our owned_form's Owner properties to null, and
+ clear the owned_forms collection.
+ (WM_CLOSE): clean up this a little bit.. still not right though.
+
+ * ApplicationContext.cs: OnMainFormClosed should only call
+ ExitThreadCore if the main form isn't recreating. Fixes unit
+ test.
+
2006-11-15 Jonathan Pobst <[EMAIL PROTECTED]>
[Fixes 78346]
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
2006-11-16 00:51:58 UTC (rev 67965)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Form.cs
2006-11-16 00:53:11 UTC (rev 67966)
@@ -764,7 +764,8 @@
owner.RemoveOwnedForm(this);
}
owner = value;
- owner.AddOwnedForm(this);
+ if (owner != null)
+ owner.AddOwnedForm(this);
if (IsHandleCreated) {
if (owner != null &&
owner.IsHandleCreated) {
XplatUI.SetTopmost(this.window.Handle, owner.window.Handle, true);
@@ -1397,12 +1398,9 @@
XplatUI.SetTopmost(window.Handle,
owner.window.Handle, true);
}
- if (owned_forms.Count > 0) {
- for (int i = 0; i < owned_forms.Count; i++) {
- if (owned_forms[i].IsHandleCreated) {
-
XplatUI.SetTopmost(owned_forms[i].window.Handle, window.Handle, true);
- }
- }
+ for (int i = 0; i < owned_forms.Count; i++) {
+ if (owned_forms[i].IsHandleCreated)
+
XplatUI.SetTopmost(owned_forms[i].window.Handle, window.Handle, true);
}
if (window_manager != null && window_state !=
FormWindowState.Normal) {
@@ -1416,7 +1414,13 @@
base.DefWndProc (ref m);
}
- protected override void Dispose(bool disposing) {
+ protected override void Dispose(bool disposing)
+ {
+ for (int i = 0; i < owned_forms.Count; i++)
+ ((Form)owned_forms[i]).Owner = null;
+
+ owned_forms.Clear ();
+
base.Dispose (disposing);
}
@@ -1778,20 +1782,21 @@
OnClosing (args);
if (!args.Cancel) {
OnClosed
(EventArgs.Empty);
+ closing = true;
}
Dispose ();
- return;
} else {
OnClosing (args);
- if (!args.Cancel) {
+ if (args.Cancel) {
+ DialogResult =
DialogResult.None;
+ closing = false;
+ } else {
OnClosed
(EventArgs.Empty);
closing = true;
- } else {
- DialogResult =
DialogResult.None;
- closing = false;
+ Hide ();
}
- Hide ();
}
+
return;
}
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches