From 5a24fc5d2f46855ac9c3abf96865f330b75d08f2 Mon Sep 17 00:00:00 2001 From: sg Date: Tue, 22 Feb 2000 14:31:04 +0000 Subject: [PATCH] * Added destructor, to fix memory leaks --- fcl/shedit/gtk/gtkshedit.pp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/fcl/shedit/gtk/gtkshedit.pp b/fcl/shedit/gtk/gtkshedit.pp index c41137a6d8..4c00dfdec3 100644 --- a/fcl/shedit/gtk/gtkshedit.pp +++ b/fcl/shedit/gtk/gtkshedit.pp @@ -55,7 +55,7 @@ type FontStyle: TSHFontStyle; end; - TSHStyleArray = array[1..1] of TSHStyle; // Notice the 1! + TSHStyleArray = array[1..255] of TSHStyle; // Notice the 1! PSHStyleArray = ^TSHStyleArray; @@ -111,6 +111,7 @@ type Widget: PGtkWidget; // this is the outer editor widget constructor Create(ADoc: TTextDoc; AEditClass: TSHTextEditClass); + destructor Destroy; override; procedure SetFocus; @@ -323,6 +324,13 @@ begin FEdit.AddKeyDef(@FEdit.EditRedo, selClear, 'Redo last undone action', GDK_Backspace, [ssShift, ssAlt]); end; +destructor TGtkSHWidget.Destroy; +begin + FreeMem(SHStyles); + FEdit.Free; + inherited Destroy; +end; + function TGtkSHWidget.AddSHStyle(AName: String; AColor, ABackground: LongWord; AStyle: TSHFontStyle): Integer; begin @@ -565,7 +573,10 @@ end. { $Log$ - Revision 1.3 2000-01-31 19:26:13 sg + Revision 1.4 2000-02-22 14:31:04 sg + * Added destructor, to fix memory leaks + + Revision 1.3 2000/01/31 19:26:13 sg * Changed to the new interface Revision 1.2 2000/01/07 01:24:34 peter