Browse Source

Add ObjectDisposedException to the catch block.

BDisp 8 months ago
parent
commit
d31f43d47d

+ 7 - 2
Terminal.Gui/ConsoleDrivers/CursesDriver/UnixMainLoop.cs

@@ -167,9 +167,14 @@ internal class UnixMainLoop (ConsoleDriver consoleDriver) : IMainLoopDriver
                     {
                         ((IMainLoopDriver)this)._waitForInput.Wait (_inputHandlerTokenSource.Token);
                     }
-                    catch (OperationCanceledException)
+                    catch (Exception ex)
                     {
-                        return;
+                        if (ex is OperationCanceledException or ObjectDisposedException)
+                        {
+                            return;
+                        }
+
+                        throw;
                     }
 
                     ((IMainLoopDriver)this)._waitForInput.Reset ();

+ 7 - 2
Terminal.Gui/ConsoleDrivers/NetDriver/NetMainLoop.cs

@@ -126,9 +126,14 @@ internal class NetMainLoop : IMainLoopDriver
                     {
                         _waitForProbe.Wait (_inputHandlerTokenSource.Token);
                     }
-                    catch (OperationCanceledException)
+                    catch (Exception ex)
                     {
-                        return;
+                        if (ex is OperationCanceledException or ObjectDisposedException)
+                        {
+                            return;
+                        }
+
+                        throw;
                     }
 
                     _waitForProbe.Reset ();

+ 7 - 2
Terminal.Gui/ConsoleDrivers/WindowsDriver/WindowsConsole.cs

@@ -191,9 +191,14 @@ internal class WindowsConsole
                     }
                 }
             }
-            catch (Exception)
+            catch (Exception ex)
             {
-                return null;
+                if (ex is OperationCanceledException or ObjectDisposedException)
+                {
+                    return null;
+                }
+
+                throw;
             }
         }
 

+ 7 - 2
Terminal.Gui/ConsoleDrivers/WindowsDriver/WindowsMainLoop.cs

@@ -162,9 +162,14 @@ internal class WindowsMainLoop : IMainLoopDriver
                     {
                         ((IMainLoopDriver)this)._waitForInput.Wait (_inputHandlerTokenSource.Token);
                     }
-                    catch (OperationCanceledException)
+                    catch (Exception ex)
                     {
-                        return;
+                        if (ex is OperationCanceledException or ObjectDisposedException)
+                        {
+                            return;
+                        }
+
+                        throw;
                     }
 
                     ((IMainLoopDriver)this)._waitForInput.Reset ();