Trying to do CopyRect in a simple FPC-program (se below) I get the following error:
Error Project copyk raised exception class 'External: SIGSEGV'. Infile lclintF.inc’ at line 182: Result := WidgetSet.Rawimage_QueryDescription(AFlags,ADesc);
on the line png0.Canvas.CopyRect(r,png1.Canvas,r);.
The same program run as a procedure in a Lazarus application behaves as expected.
What have I missed and what can I do?
program copyk;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}
cthreads,
{$ENDIF}
Classes
,graphics, GraphType
;
var png0,png1:TPortableNetworkGraphic; r:trect;
begin
png0:=TPortableNetworkGraphic.Create;
png0.LoadFromFile('U.png');
png1:=TPortableNetworkGraphic.Create;
png1.LoadFromFile('k1.png');
r:=TRect.Create(0, 0, png1.Width, png1.Height);
png0.Canvas.CopyRect(r,png1.Canvas,r);
png0.SaveToFile('p.png');
end.
I have Lazarus Version: 3.8 Date: 2025-08-13 FPC Version: 3.2.2, x86_64-linux-gtk2 on Ubuntu 22.4.