Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -191,20 +191,4 @@ private async Task OnClickBar()
internal void SetVisible(bool visible) => Visible = visible;

internal void SetLock(bool isLock) => IsLock = isLock;

/// <summary>
/// <inheritdoc/>
/// </summary>
/// <param name="disposing"></param>
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);

if (OnClickTitleBarCallback != null)
{
OnClickTitleBarCallback = null;
}

DockView.RemoveComponentState(Key);
}
}
Comment on lines 191 to 194
Copy link

Copilot AI Apr 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DockViewComponent no longer overrides Dispose(bool), so DockView.RemoveComponentState(Key) is never called. _componentStates in DockViewV2 holds a strong reference to DockViewComponent via DockViewComponentState.Component, which can cause memory leaks and can also break re-adding a component with the same Key (since TryAdd will fail while the stale entry remains). Consider restoring the Dispose(bool) override (calling base.Dispose(disposing) and using DockView?.RemoveComponentState(Key)), so component state is removed when the component is disposed.

Copilot uses AI. Check for mistakes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace BootstrapBlazor.Components;
/// <para lang="zh">DockView 标题栏组件</para>
/// <para lang="en">DockView title bar component</para>
/// </summary>
public partial class DockViewTitleBar : IAsyncDisposable
public partial class DockViewTitleBar
{
/// <summary>
/// <para lang="zh">获得/设置 标题前置图标点击回调方法,默认为 null</para>
Expand Down Expand Up @@ -40,29 +40,4 @@ private async Task OnClickBar()
await OnClickBarCallback();
}
}

/// <summary>
/// <inheritdoc/>
/// </summary>
/// <param name="disposing"></param>
/// <returns></returns>
protected virtual ValueTask DisposeAsync(bool disposing)
{
if (disposing)
{
OnClickBarCallback = null;
}

return ValueTask.CompletedTask;
}

/// <summary>
/// <inheritdoc/>
/// </summary>
/// <returns></returns>
public async ValueTask DisposeAsync()
{
await DisposeAsync(true);
GC.SuppressFinalize(this);
}
}
Loading