Code fixes, there was an error in the disposing of a DrawableContainer...

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2536 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2013-03-26 16:40:25 +00:00
parent 7823138adc
commit 7a4ac7e4f9
3 changed files with 16 additions and 9 deletions

View file

@ -61,6 +61,7 @@ namespace Greenshot.Drawing {
grippers[i] = null; grippers[i] = null;
} }
} }
grippers = null;
} }
FieldAggregator aggProps = parent.FieldAggregator; FieldAggregator aggProps = parent.FieldAggregator;

View file

@ -93,7 +93,7 @@ namespace Greenshot.Drawing {
public Image Image { public Image Image {
set { set {
// Remove all current bitmaps // Remove all current bitmaps
Dispose(true); disposeImages();
image = ImageHelper.Clone(value); image = ImageHelper.Clone(value);
bool shadow = GetFieldValueAsBool(FieldType.SHADOW); bool shadow = GetFieldValueAsBool(FieldType.SHADOW);
CheckShadow(shadow); CheckShadow(shadow);
@ -118,18 +118,24 @@ namespace Greenshot.Drawing {
/// <param name="disposing"></param> /// <param name="disposing"></param>
protected override void Dispose(bool disposing) { protected override void Dispose(bool disposing) {
if (disposing) { if (disposing) {
if (image != null) { disposeImages();
image.Dispose();
}
if (shadowBitmap != null) {
shadowBitmap.Dispose();
}
} }
image = null; image = null;
shadowBitmap = null; shadowBitmap = null;
base.Dispose(disposing); base.Dispose(disposing);
} }
private void disposeImages() {
if (image != null) {
image.Dispose();
}
if (shadowBitmap != null) {
shadowBitmap.Dispose();
}
image = null;
shadowBitmap = null;
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>
@ -153,7 +159,7 @@ namespace Greenshot.Drawing {
Image newImage = ImageHelper.RotateFlip((Bitmap)image, rotateFlipType); Image newImage = ImageHelper.RotateFlip((Bitmap)image, rotateFlipType);
if (newImage != null) { if (newImage != null) {
// Remove all current bitmaps, also the shadow (will be recreated) // Remove all current bitmaps, also the shadow (will be recreated)
Dispose(true); disposeImages();
image = newImage; image = newImage;
} }
base.Rotate(rotateFlipType); base.Rotate(rotateFlipType);

View file

@ -183,7 +183,7 @@ namespace GreenshotPlugin.Core {
/// <param name="x"></param> /// <param name="x"></param>
/// <param name="y"></param> /// <param name="y"></param>
/// <returns></returns> /// <returns></returns>
bool Contains(int x, int y); new bool Contains(int x, int y);
/// <summary> /// <summary>
/// Set the color at the specified location, using offsetting so the original coordinates can be used /// Set the color at the specified location, using offsetting so the original coordinates can be used