浏览代码

Fixed menubar/Border crash

Tig 1 年之前
父节点
当前提交
fe662398d2
共有 1 个文件被更改,包括 8 次插入1 次删除
  1. 8 1
      Terminal.Gui/Application/Application.Mouse.cs

+ 8 - 1
Terminal.Gui/Application/Application.Mouse.cs

@@ -187,10 +187,17 @@ public static partial class Application // Mouse handling
             }
 
             //System.Diagnostics.Debug.WriteLine ($"{nme.Flags};{nme.X};{nme.Y};{mouseGrabView}");
-            if (MouseGrabView.NewMouseEvent (viewRelativeMouseEvent) is true)
+            if (MouseGrabView?.NewMouseEvent (viewRelativeMouseEvent) is true)
             {
                 return;
             }
+
+            // ReSharper disable once ConditionIsAlwaysTrueOrFalse
+            if (MouseGrabView is null && view is Adornment)
+            {
+                // The view that grabbed the mouse has been disposed
+                return;
+            }
         }
 
         // We can combine this into the switch expression to reduce cognitive complexity even more and likely