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 = null;
}
FieldAggregator aggProps = parent.FieldAggregator;

View file

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

View file

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