Added a check, preventing additional disposing.

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2392 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-12-18 14:41:59 +00:00
commit 8aeb07e1e9

View file

@ -125,9 +125,11 @@ namespace GreenshotPlugin.Core {
try { try {
// The following block of modifications should be skipped when saving the greenshot format, no effects or otherwise! // The following block of modifications should be skipped when saving the greenshot format, no effects or otherwise!
if (outputSettings.Format != OutputFormat.greenshot) { if (outputSettings.Format != OutputFormat.greenshot) {
Image tmpImage;
if (outputSettings.Effects != null && outputSettings.Effects.Count > 0) {
// apply effects, if there are any // apply effects, if there are any
Point ignoreOffset; Point ignoreOffset;
Image tmpImage = ImageHelper.ApplyEffects((Bitmap)imageToSave, outputSettings.Effects, out ignoreOffset); tmpImage = ImageHelper.ApplyEffects((Bitmap)imageToSave, outputSettings.Effects, out ignoreOffset);
if (tmpImage != null) { if (tmpImage != null) {
if (disposeImage) { if (disposeImage) {
imageToSave.Dispose(); imageToSave.Dispose();
@ -135,6 +137,7 @@ namespace GreenshotPlugin.Core {
imageToSave = tmpImage; imageToSave = tmpImage;
disposeImage = true; disposeImage = true;
} }
}
// Removing transparency if it's not supported in the output // Removing transparency if it's not supported in the output
if (imageFormat != ImageFormat.Png && Image.IsAlphaPixelFormat(imageToSave.PixelFormat)) { if (imageFormat != ImageFormat.Png && Image.IsAlphaPixelFormat(imageToSave.PixelFormat)) {