From 0461f7411ccd24930934ab65ab442d2d17ede660 Mon Sep 17 00:00:00 2001 From: dmg Date: Sun, 16 May 2021 13:45:04 +0300 Subject: [PATCH] Fix PixBufAnimation ctors leak Taken from PixBuf ctors. --- Source/Libs/GdkSharp/PixbufAnimation.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/Source/Libs/GdkSharp/PixbufAnimation.cs b/Source/Libs/GdkSharp/PixbufAnimation.cs index 721ebe91e..30f96b7e3 100644 --- a/Source/Libs/GdkSharp/PixbufAnimation.cs +++ b/Source/Libs/GdkSharp/PixbufAnimation.cs @@ -39,13 +39,21 @@ namespace Gdk { if (error != IntPtr.Zero) throw new GLib.GException(error); } - public PixbufAnimation (System.IO.Stream stream) : base (new PixbufLoader (stream).AnimationHandle) {} + public PixbufAnimation (System.IO.Stream stream) : base (IntPtr.Zero) + { + using (var pl = new PixbufLoader (stream)) { + Raw = pl.AnimationHandle; + } + } public PixbufAnimation (System.Reflection.Assembly assembly, string resource) : base (IntPtr.Zero) { if (assembly == null) assembly = System.Reflection.Assembly.GetCallingAssembly (); - Raw = new PixbufLoader (assembly, resource).AnimationHandle; + + using (var pl = new PixbufLoader (assembly, resource)) { + Raw = pl.AnimationHandle; + } } static public PixbufAnimation LoadFromResource (string resource)