remove static instance field
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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()
|
||||
|
||||
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user