diff --git a/ChangeLog b/ChangeLog index ccc185c64..04ca7f8c9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2006-01-09 Brad Taylor + + * gdk/Pixbuf.custom: Properly dispose of PixbufLoaders when we're done + with them. + 2006-12-28 Brad Taylor * sample/GtkDemo/Makefile.am: diff --git a/gdk/Pixbuf.custom b/gdk/Pixbuf.custom index 31101251d..7cf3d5b9d 100644 --- a/gdk/Pixbuf.custom +++ b/gdk/Pixbuf.custom @@ -101,24 +101,47 @@ gdk_pixbuf_render_to_drawable_alpha(Handle, drawable.Handle, src_x, src_y, dest_x, dest_y, width, height, (int) alpha_mode, alpha_threshold, (int) dither, x_dither, y_dither); } - public Pixbuf (System.IO.Stream stream) : base (new PixbufLoader (stream).PixbufHandle) {} + public Pixbuf (System.IO.Stream stream) : base (IntPtr.Zero) + { + using (PixbufLoader pl = new PixbufLoader (stream)) { + Raw = pl.PixbufHandle; + } + } - public Pixbuf (System.IO.Stream stream, int width, int height) : base(new PixbufLoader (stream, width, height).PixbufHandle) {} + public Pixbuf (System.IO.Stream stream, int width, int height) : base (IntPtr.Zero) + { + using (PixbufLoader pl = new PixbufLoader (stream, width, height)) { + Raw = pl.PixbufHandle; + } + } public Pixbuf (System.Reflection.Assembly assembly, string resource) : base (IntPtr.Zero) { - Raw = new PixbufLoader (assembly == null ? System.Reflection.Assembly.GetCallingAssembly () : assembly, resource).PixbufHandle; + using (PixbufLoader pl = new PixbufLoader (assembly == null ? System.Reflection.Assembly.GetCallingAssembly () : assembly, resource)) { + Raw = pl.PixbufHandle; + } } public Pixbuf (System.Reflection.Assembly assembly, string resource, int width, int height) : base (IntPtr.Zero) { - Raw = new PixbufLoader (assembly == null ? System.Reflection.Assembly.GetCallingAssembly () : assembly, resource, width, height).PixbufHandle; + using (PixbufLoader pl = new PixbufLoader (assembly == null ? System.Reflection.Assembly.GetCallingAssembly () : assembly, resource, width, height)) { + Raw = pl.PixbufHandle; + } } - public Pixbuf (byte[] buffer) : base(new PixbufLoader (buffer).PixbufHandle) {} + public Pixbuf (byte[] buffer) : base (IntPtr.Zero) + { + using (PixbufLoader pl = new PixbufLoader (buffer)) { + Raw = pl.PixbufHandle; + } + } - - public Pixbuf (byte[] buffer, int width, int height) : base(new PixbufLoader (buffer, width, height).PixbufHandle) {} + public Pixbuf (byte[] buffer, int width, int height) : base (IntPtr.Zero) + { + using (PixbufLoader pl = new PixbufLoader (buffer, width, height)) { + Raw = pl.PixbufHandle; + } + } static public Pixbuf LoadFromResource (string resource) {