From bc67d8469beccf125c6b809e727e9cd7a67ddb66 Mon Sep 17 00:00:00 2001 From: iamboss Date: Wed, 21 Oct 2026 19:18:51 +0800 Subject: [PATCH] fix(demos): the machining demos dispose their LocalProjectService before LocalApp.AppEnd -- DemoUseMachiningProject, DemoBuildMachiningProject and DemoBuildGeomOnlyMachiningProject ended with machiningProject.Dispose(); LocalApp.AppEnd();, so the service was never disposed: MachiningProject.Dispose releases only the project's TimeMapping, while the service's machining runner keeps its threads, its native pipeline, the strip and the workpiece tree, everything AppEnd's documentation asks to be gone before it ends the native core. Each demo now disposes the service right after the project, one line with a comment saying why; not a using declaration, which would dispose it after AppEnd. Co-Authored-By: Claude Opus 5.5 --- Machining/DemoBuildGeomOnlyMachiningProject.cs | 2 ++ Machining/DemoBuildMachiningProject.cs | 2 ++ Machining/DemoUseMachiningProject.cs | 2 ++ 3 files changed, 6 insertions(+) diff --git a/Machining/DemoBuildGeomOnlyMachiningProject.cs b/Machining/DemoBuildGeomOnlyMachiningProject.cs index ef584be..f397c2c 100644 --- a/Machining/DemoBuildGeomOnlyMachiningProject.cs +++ b/Machining/DemoBuildGeomOnlyMachiningProject.cs @@ -96,6 +96,8 @@ public static class DemoBuildGeomOnlyMachiningProject localProjectService.SaveProject(); machiningProject.Dispose(); + //the service holds the play threads, the strip and the cut workpiece tree: dispose it before AppEnd + localProjectService.Dispose(); LocalApp.AppEnd(); } diff --git a/Machining/DemoBuildMachiningProject.cs b/Machining/DemoBuildMachiningProject.cs index 7bf12bc..ee7aa86 100644 --- a/Machining/DemoBuildMachiningProject.cs +++ b/Machining/DemoBuildMachiningProject.cs @@ -216,6 +216,8 @@ public static class DemoBuildMachiningProject machiningProject.MakeXmlSourceToFile(projectPath); machiningProject.Dispose(); + //the service holds the play threads, the strip and the cut workpiece tree: dispose it before AppEnd + localProjectService.Dispose(); LocalApp.AppEnd(); } #endregion diff --git a/Machining/DemoUseMachiningProject.cs b/Machining/DemoUseMachiningProject.cs index a906fb0..1f7c87a 100644 --- a/Machining/DemoUseMachiningProject.cs +++ b/Machining/DemoUseMachiningProject.cs @@ -85,6 +85,8 @@ public static class DemoUseMachiningProject #region CleanupResources Console.WriteLine($"Close Project: {projectPath}"); machiningProject.Dispose(); + //the service holds the play threads, the strip and the cut workpiece tree: dispose it before AppEnd + localProjectService.Dispose(); LocalApp.AppEnd();