dispose of isDirty subscription when tab is freed
This commit is contained in:
@@ -74,17 +74,19 @@ public partial class CodeEditorPanel : MarginContainer
|
||||
_tabContainer.SetTabTitle(newTabIndex, file.Name);
|
||||
_tabContainer.SetTabTooltip(newTabIndex, file.Path);
|
||||
_tabContainer.CurrentTab = newTabIndex;
|
||||
});
|
||||
file.IsDirty.Skip(1).SubscribeOnThreadPool().SubscribeAwait(async (isDirty, ct) =>
|
||||
{
|
||||
//GD.Print($"File dirty state changed: {file.Path} is now {(isDirty ? "dirty" : "clean")}");
|
||||
await this.InvokeAsync(() =>
|
||||
|
||||
file.IsDirty.Skip(1).SubscribeOnThreadPool().SubscribeAwait(async (isDirty, ct) =>
|
||||
{
|
||||
var tabIndex = newTab.GetIndex();
|
||||
var title = file.Name + (isDirty ? " (*)" : "");
|
||||
_tabContainer.SetTabTitle(tabIndex, title);
|
||||
});
|
||||
//GD.Print($"File dirty state changed: {file.Path} is now {(isDirty ? "dirty" : "clean")}");
|
||||
await this.InvokeAsync(() =>
|
||||
{
|
||||
var tabIndex = newTab.GetIndex();
|
||||
var title = file.Name + (isDirty ? " (*)" : "");
|
||||
_tabContainer.SetTabTitle(tabIndex, title);
|
||||
});
|
||||
}).AddTo(newTab); // needs to be on ui thread
|
||||
});
|
||||
|
||||
await newTab.SetSharpIdeFile(file);
|
||||
if (fileLinePosition is not null) await this.InvokeAsync(() => newTab.SetFileLinePosition(fileLinePosition.Value));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user