Browse Source

Fixed wait cursor not being disposed when exceptions happen in DYnamicGrid.Refresh

Kenric Nugteren 10 months ago
parent
commit
487cc165e3
1 changed files with 1 additions and 7 deletions
  1. 1 7
      inabox.wpf/DynamicGrid/DynamicGrid.cs

+ 1 - 7
inabox.wpf/DynamicGrid/DynamicGrid.cs

@@ -1022,7 +1022,7 @@ public abstract class DynamicGrid<T> : DynamicGrid, IDynamicGridUIComponentParen
 
         UIComponent.BeforeRefresh();
 
-        var cursor = UseWaitCursor ? new WaitCursor() : null;
+        using var cursor = UseWaitCursor ? new WaitCursor() : null;
 
         Loading.Visibility = Visibility.Visible;
         Loading.BeginAnimation(Label.OpacityProperty, LoadingFader);
@@ -1103,12 +1103,6 @@ public abstract class DynamicGrid<T> : DynamicGrid, IDynamicGridUIComponentParen
             Loading.BeginAnimation(Label.OpacityProperty, null);
             Loading.Visibility = Visibility.Collapsed;
         }
-
-        if (cursor != null)
-        {
-            cursor.Dispose();
-            cursor = null;
-        }
     }
 
     public void Shutdown()