Skip to content

Commit 344f611

Browse files
committed
refactor: 更改为异步释放资源
1 parent 7f88927 commit 344f611

1 file changed

Lines changed: 7 additions & 12 deletions

File tree

src/components/BootstrapBlazor.DockView/Components/DockViewV2.razor.cs

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace BootstrapBlazor.Components;
1212
/// <para lang="zh">DockViewV2 组件</para>
1313
/// <para lang="en">DockViewV2 component</para>
1414
/// </summary>
15-
public partial class DockViewV2 : IDisposable
15+
public partial class DockViewV2
1616
{
1717
/// <summary>
1818
/// <para lang="zh">获得/设置 DockView 名称,默认为 null,用于本地存储标识</para>
@@ -413,20 +413,15 @@ internal void UpdateComponentState(string? key, bool visible, bool? isLock)
413413
return state;
414414
}
415415

416-
private void Dispose(bool disposing)
417-
{
418-
if (disposing)
419-
{
420-
ThemeProviderService.ThemeChangedAsync -= OnThemeChangedAsync;
421-
}
422-
}
423-
424416
/// <summary>
425417
/// <inheritdoc/>
426418
/// </summary>
427-
public void Dispose()
419+
/// <param name="disposing"></param>
420+
/// <returns></returns>
421+
protected override ValueTask DisposeAsync(bool disposing)
428422
{
429-
Dispose(true);
430-
GC.SuppressFinalize(this);
423+
ThemeProviderService.ThemeChangedAsync -= OnThemeChangedAsync;
424+
425+
return base.DisposeAsync(disposing);
431426
}
432427
}

0 commit comments

Comments
 (0)