First code analysis changes, this "should" make Greenshot more stable and implement things as is supposed.

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2481 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2013-02-12 18:43:56 +00:00
parent 3f4d93f2b6
commit a394904aa3
64 changed files with 514 additions and 343 deletions

View file

@ -94,39 +94,23 @@ namespace Greenshot.Drawing {
Init();
UpdateFormat();
}
/**
* Destructor
*/
~TextContainer() {
Dispose(false);
}
/**
* The public accessible Dispose
* Will call the GarbageCollector to SuppressFinalize, preventing being cleaned twice
*/
public override void Dispose() {
Dispose(true);
base.Dispose();
GC.SuppressFinalize(this);
}
/**
* This Dispose is called from the Dispose and the Destructor.
* When disposing==true all non-managed resources should be freed too!
*/
protected virtual void Dispose(bool disposing) {
protected override void Dispose(bool disposing) {
if (disposing) {
if (textBox != null) {
textBox.Dispose();
}
if (font != null) {
font.Dispose();
font = null;
}
if (stringFormat != null) {
stringFormat.Dispose();
stringFormat = null;
}
if (textBox != null) {
textBox.Dispose();
textBox = null;
}
}
textBox = null;
font = null;
base.Dispose(disposing);
}
private void Init() {