<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<p>Il 21/04/2018 18:07, Vojtěch Čihák via Lazarus ha scritto:<br>
</p>
<blockquote type="cite" cite="mid:20180421180724.027DDBC2@atlas.cz">
<p style="padding:0 0 0 0; margin:0 0 0 0;">@ <span
style="font-size: 10pt;">MyBitmap := Image1.Picture.Bitmap;</span></p>
<p style="padding:0 0 0 0; margin:0 0 0 0;">This line only copies
pointer, but I<span style="font-size: 10pt;">mage1.Picture.Bitmap
belongs to Image1 and it should care itself.</span></p>
</blockquote>
<br>
That's what I had guessed, but this means that there's a patent
inconsistency, as shown in the Button2Click part of my test:<br>
<pre><blockquote type="cite"> Image1.Picture.Bitmap := MyBitmap;
FreeAndNil(MyBitmap);
</blockquote></pre>
doesn't generate any error. If I don't free MyBitmap I see a memory
leakage in heaptrc.<br>
<br>
IOW<br>
<pre>Image1.Picture.Bitmap := MyBitmap;</pre>
performs an implicit assign, creating a new Bitmap Object for
Image1.<br>
<br>
The apparently symmetrical<br>
<pre>MyBitmap := Image1.Picture.Bitmap;
</pre>
just copies the pointer. Timage.Picture.GetBitmap and
TImage.Picture.SetBitmap do not follow the same logic.<br>
<br>
All of this is maybe somewhat Delphi compatible. Actually Delphi
(Rad Studio 10.1) doesn't generate a SIGSEV with the same code, but
rather just an "Illegal Pointer Operation" warning. However IMO it
still remains quite inconsistent.<br>
<br>
Giuliano<br>
<br>
</body>
</html>