mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-01 20:12:36 +02:00
IDEIntf: fixed creation/freeing in TGraphicPropertyEditor.Edit
git-svn-id: trunk@15534 -
This commit is contained in:
parent
ea148e0664
commit
3beabb68e9
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user