mirror of
https://github.com/greenshot/greenshot
synced 2025-08-20 13:33:27 -07:00
Made replacing the image more secure, the old code MIGHT have resulted in the Bug #3052665
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@868 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
2c8bf66009
commit
cb8d8497c9
1 changed files with 13 additions and 6 deletions
|
@ -104,14 +104,21 @@ namespace Greenshot.Drawing {
|
|||
}
|
||||
|
||||
private void SetImage(Image image) {
|
||||
if (originalImage != null) {
|
||||
originalImage.Dispose();
|
||||
}
|
||||
if (Image != null) {
|
||||
Image.Dispose();
|
||||
}
|
||||
// Store old value
|
||||
Image tmpOriginal = originalImage;
|
||||
Image tmpImage = Image;
|
||||
|
||||
// Set new values
|
||||
originalImage = new Bitmap(image);
|
||||
Image = new Bitmap(image);
|
||||
|
||||
// Dispose them
|
||||
if (tmpOriginal != null) {
|
||||
tmpOriginal.Dispose();
|
||||
}
|
||||
if (tmpImage != null) {
|
||||
tmpImage.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
public Surface(Image image) : this() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue