Merge pull request #250 from zii-dmg/FixPixBufAnimationLeak

Fix PixBufAnimation ctors leak

@zii-dmg  thanks!
This commit is contained in:
lytico 2021-05-16 18:14:22 +02:00 committed by GitHub
commit 6a0e721132
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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)