Browse Source
* Fix for Issue#16451 * Remove the pen from the brush observers without queuing the pen for invalidation.pull/20084/head
committed by
Julien Lebosquain
1 changed files with 12 additions and 5 deletions
@ -1,12 +1,19 @@ |
|||||
using System; |
|
||||
using Avalonia.Media; |
using Avalonia.Media; |
||||
using Avalonia.Media.Immutable; |
|
||||
using Avalonia.Rendering.Composition.Server; |
|
||||
using Avalonia.Rendering.Composition.Transport; |
|
||||
|
|
||||
namespace Avalonia.Rendering.Composition.Server; |
namespace Avalonia.Rendering.Composition.Server; |
||||
|
|
||||
internal partial class ServerCompositionSimplePen : IPen |
internal partial class ServerCompositionSimplePen : IPen |
||||
{ |
{ |
||||
IDashStyle? IPen.DashStyle => DashStyle; |
IDashStyle? IPen.DashStyle => DashStyle; |
||||
} |
|
||||
|
/// <inheritdoc/>
|
||||
|
public override void Dispose() |
||||
|
{ |
||||
|
// Remove the pen from the brush observers.
|
||||
|
// Without this, the pen was being retained in memory by long lived brush resources (e.g. those defined in
|
||||
|
// the theme or app resources), hence was causing memory leaks; see Issue #16451
|
||||
|
RemoveObserversFromProperty(ref _brush); |
||||
|
_brush = null; |
||||
|
base.Dispose(); |
||||
|
} |
||||
|
} |
||||
|
|||||
Loading…
Reference in new issue