sageryd
asked on
Pointers
Would it be wrong not to free "B" in GetImage? Because if I do, there's an AV, and if I don't it works fine. Below is a simplification of the real code, removed irrelevant information:
procedure TMainForm.SomeProcedure;
begin
Image1.Picure.Bitmap:=GetI mage; //Image1 is a TImage
end;
function TMainForm.GetImage: TBitmap;
var B: TBitmap;
begin
B:=TBitmap.Create;
B.Assign(ADODataSet.FieldB yName('Ima ge'));
Result:=B;
end;
thx
procedure TMainForm.SomeProcedure;
begin
Image1.Picure.Bitmap:=GetI
end;
function TMainForm.GetImage: TBitmap;
var B: TBitmap;
begin
B:=TBitmap.Create;
B.Assign(ADODataSet.FieldB
Result:=B;
end;
thx
yes it would be wrong to free the Bitmap in GetImage,
function TMainForm.GetImage: TBitmap;
begin
Result:=TBitmap.Create;
Result.Assign(ADODataSet.F ieldByName ('Image')) ;
end;
no problem with destroying B :-))
ziolko.
begin
Result:=TBitmap.Create;
Result.Assign(ADODataSet.F
end;
no problem with destroying B :-))
ziolko.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Exactly my thought, thanks for the verification. ;)
Ziolko, thanks for the simplification. Though I will reward sfock the points since he made the explanation in human text.
OOH I LOVE E-E :)
Ziolko, thanks for the simplification. Though I will reward sfock the points since he made the explanation in human text.
OOH I LOVE E-E :)
ok no problem:-)
ziolko.
ziolko.
ASKER
Unless of course you need points I could get reward ye some aswell ;) haha
:-) I'll take my points when I deserve them.
ziolko.
ziolko.
ASKER
Either way!
*Grawrlph*
*Grawrlph*