From 3beabb68e9aeb2dccb3906438b1105af034d81ee Mon Sep 17 00:00:00 2001 From: mattias Date: Mon, 23 Jun 2008 11:35:26 +0000 Subject: [PATCH] IDEIntf: fixed creation/freeing in TGraphicPropertyEditor.Edit git-svn-id: trunk@15534 - --- ideintf/graphpropedits.pas | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ideintf/graphpropedits.pas b/ideintf/graphpropedits.pas index 27c733bed8..0daf5a0a60 100644 --- a/ideintf/graphpropedits.pas +++ b/ideintf/graphpropedits.pas @@ -175,9 +175,11 @@ procedure TGraphicPropertyEditor.Edit; var TheDialog: TGraphicPropertyEditorForm; AGraphic: TGraphic; + FreeGraphic: Boolean; begin AGraphic := TGraphic(GetObjectValue(TGraphic)); TheDialog := TGraphicPropertyEditorForm.Create(nil); + FreeGraphic:=false; try if (AGraphic <> nil) then TheDialog.Preview.Picture.Assign(AGraphic) @@ -192,11 +194,14 @@ begin begin {$Warnings off} // TGraphic itself is an abstract class, so the compiler will warn - if AGraphic = nil then - AGraphic := TGraphic(GetTypeData(GetPropType)^.ClassType).Create; + if AGraphic = nil then begin + AGraphic := TGraphic(GetTypeData(GetPropType)^.ClassType.Create).Create; + FreeGraphic:=true; + end; {$Warnings on} AGraphic.LoadFromFile(TheDialog.FileName); + FreeGraphic:=false; SetPtrValue(AGraphic); Modified; end; @@ -209,6 +214,8 @@ begin end; end; finally + if FreeGraphic then + AGraphic.Free; TheDialog.Free; end; end;