Browse Source

try catch dispose

Krzysztof Krysiński 1 week ago
parent
commit
3e7dccb96d

+ 13 - 0
src/PixiEditor.ChangeableDocument/DocumentChangeTracker.cs

@@ -38,6 +38,19 @@ public class DocumentChangeTracker : IDisposable
     {
     {
         if (running)
         if (running)
             throw new InvalidOperationException("Something is currently being processed");
             throw new InvalidOperationException("Something is currently being processed");
+
+        if (activeUpdateableChange != null)
+        {
+            try
+            {
+                activeUpdateableChange.Apply(document, false, out var _);
+            }
+            catch (Exception e)
+            {
+                Trace.WriteLine($"Failed to apply active updateable change {activeUpdateableChange}: {e}");
+            }
+        }
+
         if (disposed)
         if (disposed)
             return;
             return;
         disposed = true;
         disposed = true;

+ 14 - 7
src/PixiEditor/ViewModels/Document/DocumentViewModel.cs

@@ -1302,13 +1302,20 @@ internal partial class DocumentViewModel : PixiObservableObject, IDocument
 
 
     public void Dispose()
     public void Dispose()
     {
     {
-        NodeGraph.Dispose();
-        Renderer.Dispose();
-        SceneRenderer.Dispose();
-        AnimationDataViewModel.Dispose();
-        Internals.ChangeController.TryStopActiveExecutor();
-        Internals.Tracker.Dispose();
-        Internals.Tracker.Document.Dispose();
+        try
+        {
+            NodeGraph.Dispose();
+            Renderer.Dispose();
+            SceneRenderer.Dispose();
+            AnimationDataViewModel.Dispose();
+            Internals.ChangeController.TryStopActiveExecutor();
+            Internals.Tracker.Dispose();
+            Internals.Tracker.Document.Dispose();
+        }
+        catch (Exception ex)
+        {
+            CrashHelper.SendExceptionInfo(ex);
+        }
     }
     }
 
 
     public VecI GetRenderOutputSize(string renderOutputName)
     public VecI GetRenderOutputSize(string renderOutputName)