[Lazarus] A bitmap strange issue

Vojtěch Čihák vojtech.cihak at atlas.cz
Sat Apr 21 18:07:24 CEST 2018


Hi,
 
@ MyBitmap := Image1.Picture.Bitmap;
This line only copies pointer, but Image1.Picture.Bitmap belongs to Image1 and it should care itself.
If you need copy of the bitmap you shoud use:
MyBitmap.Assign(Image1.Picture.Bitmap);
 
V.
 
______________________________________________________________
> Od: Giuliano Colla via Lazarus <lazarus at lists.lazarus-ide.org>
> Komu: Lazarus mailing list <lazarus at lists.lazarus-ide.org>
> Datum: 21.04.2018 17:18
> Předmět: [Lazarus] A bitmap strange issue
>
 
procedure TForm1.Button1Click(Sender: TObject); var Filename: String; begin if OpenPictureDialog1.Execute then begin // MyBitmap := Image1.Picture.Bitmap; <-------This causes a sigsev in FreeImage Filename:= OpenPictureDialog1.FileName; Image1.Picture.LoadFromFile(Filename); If assigned(MyBitmap) then begin MyBitmap.FreeImage; FreeAndNil(MyBitmap); end; end; end;Giuliano
 
 
 
 ----------
 
 -- 
 _______________________________________________
 Lazarus mailing list
 Lazarus at lists.lazarus-ide.org
 https://lists.lazarus-ide.org/listinfo/lazarus <https://lists.lazarus-ide.org/listinfo/lazarus>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20180421/6f265d81/attachment.html>


More information about the Lazarus mailing list