remove static instance field

This commit is contained in:
Matt Parker
2025-10-18 14:33:46 +10:00
parent d285ce1bf2
commit d90f0e6c28
3 changed files with 1 additions and 2 deletions

View File

@@ -9,7 +9,6 @@ namespace SharpIDE.Application.Features.FilePersistence;
/// Holds the in memory copies of files, and manages saving/loading them to/from disk.
public class IdeOpenTabsFileManager
{
public static IdeOpenTabsFileManager Instance { get; set; } = null!;
private ConcurrentDictionary<SharpIdeFile, Lazy<Task<string>>> _openFiles = new();
/// Implicitly 'opens' a file if not already open, and returns the text.

View File

@@ -48,7 +48,6 @@ public partial class IdeRoot : Control
GodotGlobalEvents.Instance = new GodotGlobalEvents();
GlobalEvents.Instance = new GlobalEvents();
BuildService.Instance = new BuildService(); // TODO: Sort out this mess with singletons, especially access across Application services
IdeOpenTabsFileManager.Instance = new IdeOpenTabsFileManager();
}
public override void _ExitTree()

View File

@@ -47,6 +47,7 @@ public partial class IdeWindow : Control
// PrintOrphanNodes();
}
// TODO: Problematic, as this is called even when the focus shifts to an embedded subwindow, such as a popup
private void OnFocusExited()
{
_ = Task.GodotRun(async () => await _openTabsFileManager.SaveAllOpenFilesAsync());