On 22.04.2018 17:06, Giuliano Colla via Lazarus wrote:
Il 22/04/2018 13:49, Ondrej Pokorny via Lazarus ha scritto:
Do you really mean that
Image1.Picture.Bitmap.SomeProperty := SomeValue;
should apply SomeProperty := SomeValue on a copied object of Bitmap
and produce a memory leak?
No, I mean that like
Image1.Picture.Bitmap := SomeBitmap;
actually executes a
Image1.Picture.Bitmap.assign(SomeBitmap);
(see TPicture.SetGraphic called by TPicture.SetBitmap in picture.inc), so
SomeBitmap := Image1.Picture.BItmap;
should execute (with proper checks)
SomeBitmap.assign(Image1.Picture.Bitmap);
You can definitely do this - but not on on the Image1.Picture side and
on the other side - SomeBitmap:
property SomeBitmap: TBitmap read GetSomeBitmap write SetSomeBitmap;
-> implement SetSomeBitmap to execute .Assign() and you are good.
Ondrej
--
_______________________________________________
Lazarus mailing list
Lazarus@lists.lazarus-ide.org
https://lists.lazarus-ide.org/listinfo/lazarus