Author: toshok
Date: 2006-11-03 14:20:38 -0500 (Fri, 03 Nov 2006)
New Revision: 67320

Modified:
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs
   trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs
Log:


Modified: 
trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs   
2006-11-03 19:17:40 UTC (rev 67319)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/Application.cs   
2006-11-03 19:20:38 UTC (rev 67320)
@@ -48,6 +48,7 @@
                        #region Fields
                        private ApplicationContext      context;
                        private bool                    messageloop_started;
+                       private bool                    handling_exception;
                        private int                     thread_id;
 
                        private static Hashtable        threads = new 
Hashtable();
@@ -79,7 +80,17 @@
                                }
                        }
 
+                       public bool HandlingException {
+                               get {
+                                       return handling_exception;
+                               }
 
+                               set {
+                                       handling_exception = value;
+                               }
+
+                       }
+
                        public static int LoopCount {
                                get {
                                        IEnumerator     e;
@@ -190,7 +201,7 @@
                #region Public Static Properties
                public static bool AllowQuit {
                        get {
-                               return browser_embedded;
+                               return !browser_embedded;
                        }
                }
 
@@ -394,6 +405,8 @@
                }
 
                public static void OnThreadException(Exception t) {
+                       MWFThread.Current.HandlingException = true;
+
                        if (Application.ThreadException != null) {
                                Application.ThreadException(null, new 
ThreadExceptionEventArgs(t));
                                return;
@@ -404,7 +417,10 @@
                                form.ShowDialog ();
                        } else {
                                Console.WriteLine (t.ToString ());
+                               Application.Exit ();
                        }
+
+                       MWFThread.Current.HandlingException = false;
                }
 
                public static void RemoveMessageFilter(IMessageFilter filter) {
@@ -425,6 +441,30 @@
                        RunLoop(false, context);
                }
 
+               static void DispatchMessage (ref MSG msg)
+               {
+                       try {
+                               XplatUI.DispatchMessage(ref msg);
+                       }
+#if USE_EXCEPTION_DIALOG
+                       catch (Exception e) {
+                               if (MWFThread.Current.HandlingException) {
+                                       /* we're already handling an exception 
and we got
+                                          another one?  print it out and exit, 
this means
+                                          we've got a runtime/SWF bug. */
+                                       Console.WriteLine (e);
+                                       Application.Exit();
+                               }
+
+                               Application.OnThreadException (e);
+                       }
+#else
+                       catch {
+                               throw;
+                       }
+#endif
+               }
+
                internal static void RunLoop(bool Modal, ApplicationContext 
context) {
                        Queue           toplevels;
                        IEnumerator     control;
@@ -529,7 +569,7 @@
                                        }
                                        default: {
                                                XplatUI.TranslateMessage(ref 
msg);
-                                               XplatUI.DispatchMessage(ref 
msg);
+                                               DispatchMessage (ref msg);
                                                break;
                                        }
                                }

Modified: trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs
===================================================================
--- trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs      
2006-11-03 19:17:40 UTC (rev 67319)
+++ trunk/mcs/class/Managed.Windows.Forms/System.Windows.Forms/ComboBox.cs      
2006-11-03 19:20:38 UTC (rev 67320)
@@ -385,6 +385,9 @@
                public override int SelectedIndex {
                        get { return selected_index; }
                        set {
+                               if (selected_index == value)
+                                       return;
+
                                if (value <= -2 || value >= Items.Count)
                                        throw new ArgumentOutOfRangeException 
("Index of out range");
                                selected_index = value;

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to