From 8aeb07e1e968e0dff4fae3858eeaabd3dba089b9 Mon Sep 17 00:00:00 2001 From: RKrom Date: Tue, 18 Dec 2012 14:41:59 +0000 Subject: [PATCH] Added a check, preventing additional disposing. git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2392 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4 --- GreenshotPlugin/Core/ImageOutput.cs | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/GreenshotPlugin/Core/ImageOutput.cs b/GreenshotPlugin/Core/ImageOutput.cs index f964caba8..93bb5cce8 100644 --- a/GreenshotPlugin/Core/ImageOutput.cs +++ b/GreenshotPlugin/Core/ImageOutput.cs @@ -125,15 +125,18 @@ namespace GreenshotPlugin.Core { try { // The following block of modifications should be skipped when saving the greenshot format, no effects or otherwise! if (outputSettings.Format != OutputFormat.greenshot) { - // apply effects, if there are any - Point ignoreOffset; - Image tmpImage = ImageHelper.ApplyEffects((Bitmap)imageToSave, outputSettings.Effects, out ignoreOffset); - if (tmpImage != null) { - if (disposeImage) { - imageToSave.Dispose(); + Image tmpImage; + if (outputSettings.Effects != null && outputSettings.Effects.Count > 0) { + // apply effects, if there are any + Point ignoreOffset; + tmpImage = ImageHelper.ApplyEffects((Bitmap)imageToSave, outputSettings.Effects, out ignoreOffset); + if (tmpImage != null) { + if (disposeImage) { + imageToSave.Dispose(); + } + imageToSave = tmpImage; + disposeImage = true; } - imageToSave = tmpImage; - disposeImage = true; } // Removing transparency if it's not supported in the output