From 11fed0214803d3b6e59a7eaff27a7910bc31fbf3 Mon Sep 17 00:00:00 2001 From: Mike Kestner Date: Fri, 16 Dec 2005 16:04:31 +0000 Subject: [PATCH] 2005-12-16 Mike Kestner * gdk/PixbufLoader.custom (InitFromAssemblyResource): move stream access code outside the try block so only the Load is cleaned up with the finally block. Add some other arg checking. [Fixes #76997] svn path=/trunk/gtk-sharp/; revision=54532 --- ChangeLog | 6 ++++++ gdk/PixbufLoader.custom | 17 ++++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 77b93eb38..f4fa8402b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-12-16 Mike Kestner + + * gdk/PixbufLoader.custom (InitFromAssemblyResource): move stream + access code outside the try block so only the Load is cleaned up with + the finally block. Add some other arg checking. [Fixes #76997] + 2005-12-13 Mike Kestner * sources/Makefile.am : move to stable gtk 2.8 versions. diff --git a/gdk/PixbufLoader.custom b/gdk/PixbufLoader.custom index b3132ffc0..70336c53e 100644 --- a/gdk/PixbufLoader.custom +++ b/gdk/PixbufLoader.custom @@ -73,6 +73,9 @@ private void InitFromStream (System.IO.Stream stream) { + if (stream == null) + throw new ArgumentNullException ("stream"); + try { LoadFromStream (stream); } finally { @@ -93,14 +96,14 @@ private void InitFromAssemblyResource(System.Reflection.Assembly assembly, string resource) { + if (assembly == null) + throw new ArgumentNullException ("assembly"); + + System.IO.Stream s = assembly.GetManifestResourceStream (resource); + if (s == null) + throw new ArgumentException ("'" + resource + "' is not a valid resource name of assembly '" + assembly + "'."); + try { - if (resource == null) - throw new ArgumentNullException ("resource"); - - System.IO.Stream s = assembly.GetManifestResourceStream (resource); - if (s == null) - throw new ArgumentException ("'" + resource + "' is not a valid resource name of assembly '" + assembly + "'."); - LoadFromStream (s); } finally { Close ();