Browse Source

Fixed d2d RenderTargetBitmap leak

Nikita Tsukanov 9 years ago
parent
commit
36515e05d7

+ 5 - 0
src/Windows/Perspex.Direct2D1/Media/Imaging/BitmapImpl.cs

@@ -74,6 +74,11 @@ namespace Perspex.Direct2D1.Media
         /// </summary>
         public int PixelHeight => WicImpl.Size.Height;
 
+        public virtual void Dispose()
+        {
+            WicImpl.Dispose();
+        }
+
         /// <summary>
         /// Gets the WIC implementation of the bitmap.
         /// </summary>

+ 3 - 2
src/Windows/Perspex.Direct2D1/Media/Imaging/RenderTargetBitmapImpl.cs

@@ -33,9 +33,10 @@ namespace Perspex.Direct2D1.Media
                 props);
         }
 
-        public void Dispose()
+        public override void Dispose()
         {
-            // TODO:
+            _target.Dispose();
+            base.Dispose();
         }
 
         public Perspex.Media.DrawingContext CreateDrawingContext() => new RenderTarget(_target).CreateDrawingContext();