From 6a010a89f2d13adba0a6cb3433f47ebc76eb467f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Krzysztof=20Krysi=C5=84ski?= Date: Tue, 11 Mar 2025 09:33:48 +0100 Subject: [PATCH] Added surface dispose to DrawingSurfaceDemoBase (#18412) --- samples/GpuInterop/DrawingSurfaceDemoBase.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/samples/GpuInterop/DrawingSurfaceDemoBase.cs b/samples/GpuInterop/DrawingSurfaceDemoBase.cs index be5d920b89..b076f5b489 100644 --- a/samples/GpuInterop/DrawingSurfaceDemoBase.cs +++ b/samples/GpuInterop/DrawingSurfaceDemoBase.cs @@ -33,7 +33,11 @@ public abstract class DrawingSurfaceDemoBase : Control, IGpuDemo protected override void OnDetachedFromLogicalTree(LogicalTreeAttachmentEventArgs e) { if (_initialized) + { + Surface?.Dispose(); FreeGraphicsResources(); + } + _initialized = false; base.OnDetachedFromLogicalTree(e); }