fix objectdb leaks on exit
This commit is contained in:
@@ -4,12 +4,17 @@ using SharpIDE.Application.Features.SolutionDiscovery.VsPersistence;
|
|||||||
|
|
||||||
namespace SharpIDE.Godot.Features.Problems;
|
namespace SharpIDE.Godot.Features.Problems;
|
||||||
|
|
||||||
public partial class DiagnosticMetadataContainer(Diagnostic diagnostic) : GodotObject
|
// public partial class GenericContainer<T>(T item) : RefCounted
|
||||||
|
// {
|
||||||
|
// public T Item { get; } = item;
|
||||||
|
// }
|
||||||
|
|
||||||
|
public partial class DiagnosticMetadataContainer(Diagnostic diagnostic) : RefCounted
|
||||||
{
|
{
|
||||||
public Diagnostic Diagnostic { get; } = diagnostic;
|
public Diagnostic Diagnostic { get; } = diagnostic;
|
||||||
}
|
}
|
||||||
|
|
||||||
public partial class ProjectContainer(SharpIdeProjectModel project) : GodotObject
|
public partial class ProjectContainer(SharpIdeProjectModel project) : RefCounted
|
||||||
{
|
{
|
||||||
public SharpIdeProjectModel Project { get; } = project;
|
public SharpIdeProjectModel Project { get; } = project;
|
||||||
}
|
}
|
||||||
@@ -35,7 +35,7 @@ public partial class ProblemsPanel : Control
|
|||||||
.Subscribe(s =>
|
.Subscribe(s =>
|
||||||
{
|
{
|
||||||
GD.Print($"ProblemsPanel: Solution changed to {s?.Name ?? "null"}");
|
GD.Print($"ProblemsPanel: Solution changed to {s?.Name ?? "null"}");
|
||||||
_projects.Clear();
|
_projects.RemoveRange(_projects);
|
||||||
_projects.AddRange(s!.AllProjects);
|
_projects.AddRange(s!.AllProjects);
|
||||||
}).AddTo(this);
|
}).AddTo(this);
|
||||||
BindToTree(_projects);
|
BindToTree(_projects);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ using SharpIDE.Application.Features.SolutionDiscovery;
|
|||||||
|
|
||||||
namespace SharpIDE.Godot.Features.SolutionExplorer;
|
namespace SharpIDE.Godot.Features.SolutionExplorer;
|
||||||
|
|
||||||
public partial class SharpIdeFileGodotContainer : GodotObject
|
public partial class SharpIdeFileGodotContainer : RefCounted
|
||||||
{
|
{
|
||||||
public required SharpIdeFile File { get; init; }
|
public required SharpIdeFile File { get; init; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -161,13 +161,6 @@ public partial class SolutionExplorerPanel : MarginContainer
|
|||||||
fileItem.SetText(0, file.Name);
|
fileItem.SetText(0, file.Name);
|
||||||
fileItem.SetIcon(0, CsharpFileIcon);
|
fileItem.SetIcon(0, CsharpFileIcon);
|
||||||
var container = new SharpIdeFileGodotContainer { File = file };
|
var container = new SharpIdeFileGodotContainer { File = file };
|
||||||
// TODO: Handle ObjectDB instances leaked at exit
|
|
||||||
fileItem.SetMetadata(0, container);
|
fileItem.SetMetadata(0, container);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
||||||
public override void _Process(double delta)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
using Ardalis.GuardClauses;
|
|
||||||
using Godot;
|
using Godot;
|
||||||
using Microsoft.Build.Locator;
|
using Microsoft.Build.Locator;
|
||||||
using Microsoft.Extensions.Hosting;
|
using Microsoft.Extensions.Hosting;
|
||||||
|
using SharpIDE.Application.Features.Events;
|
||||||
using SharpIDE.Godot.Features.SlnPicker;
|
using SharpIDE.Godot.Features.SlnPicker;
|
||||||
|
|
||||||
namespace SharpIDE.Godot;
|
namespace SharpIDE.Godot;
|
||||||
@@ -26,6 +26,16 @@ public partial class IdeWindow : Control
|
|||||||
PickSolution(true);
|
PickSolution(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// public override void _ExitTree()
|
||||||
|
// {
|
||||||
|
// GodotGlobalEvents.Instance = null!;
|
||||||
|
// GlobalEvents.Instance = null!;
|
||||||
|
// GC.Collect();
|
||||||
|
// GC.WaitForPendingFinalizers();
|
||||||
|
// GC.Collect();
|
||||||
|
// PrintOrphanNodes();
|
||||||
|
// }
|
||||||
|
|
||||||
public void PickSolution(bool fullscreen = false)
|
public void PickSolution(bool fullscreen = false)
|
||||||
{
|
{
|
||||||
if (_slnPicker is not null) throw new InvalidOperationException("Solution picker is already active");
|
if (_slnPicker is not null) throw new InvalidOperationException("Solution picker is already active");
|
||||||
|
|||||||
Reference in New Issue
Block a user