Author: toshok
Date: 2006-08-28 13:16:00 -0400 (Mon, 28 Aug 2006)
New Revision: 64481
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NativeWindow.cs
Log:
* NativeWindow.cs: lock around accesses to window_collection.
2006-08-28 Chris Toshok <[EMAIL PROTECTED]>
Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2006-08-28 16:37:44 UTC (rev 64480)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ChangeLog
2006-08-28 17:16:00 UTC (rev 64481)
@@ -1,5 +1,9 @@
2006-08-28 Chris Toshok <[EMAIL PROTECTED]>
+ * NativeWindow.cs: lock around accesses to window_collection.
+
+2006-08-28 Chris Toshok <[EMAIL PROTECTED]>
+
* Control.cs: err, fix this the right way, by locking on controls
when using it. not by making it synchronized.
Modified:
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NativeWindow.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NativeWindow.cs
2006-08-28 16:37:44 UTC (rev 64480)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/NativeWindow.cs
2006-08-28 17:16:00 UTC (rev 64481)
@@ -65,22 +65,30 @@
#region Private and Internal Methods
internal static NativeWindow FindWindow(IntPtr handle) {
- return (NativeWindow)window_collection[handle];
+ NativeWindow rv;
+ lock (window_collection) {
+ rv = (NativeWindow)window_collection[handle];
+ }
+ return rv;
}
internal void InvalidateHandle() {
- window_collection.Remove(window_handle);
+ lock (window_collection) {
+ window_collection.Remove(window_handle);
+ }
window_handle = IntPtr.Zero;
}
#endregion
#region Public Instance Methods
public void AssignHandle(IntPtr handle) {
- if (window_handle != IntPtr.Zero) {
- window_collection.Remove(window_handle);
+ lock (window_collection) {
+ if (window_handle != IntPtr.Zero) {
+ window_collection.Remove(window_handle);
+ }
+ window_handle=handle;
+ window_collection.Add(window_handle, this);
}
- window_handle=handle;
- window_collection.Add(window_handle, this);
OnHandleChange();
}
@@ -89,7 +97,9 @@
window_handle=XplatUI.CreateWindow(create_params);
if (window_handle != IntPtr.Zero) {
- window_collection.Add(window_handle,
this);
+ lock (window_collection) {
+
window_collection.Add(window_handle, this);
+ }
}
}
}
@@ -105,7 +115,9 @@
}
public virtual void ReleaseHandle() {
- window_collection.Remove(window_handle);
+ lock (window_collection) {
+ window_collection.Remove(window_handle);
+ }
window_handle=IntPtr.Zero;
OnHandleChange();
}
@@ -134,7 +146,9 @@
#if !ExternalExceptionHandler
try {
#endif
- window = (NativeWindow)window_collection[hWnd];
+ lock (window_collection) {
+ window =
(NativeWindow)window_collection[hWnd];
+ }
m.HWnd=hWnd;
m.Msg=(int)msg;
m.WParam=wParam;
_______________________________________________
Mono-patches maillist - [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches