TfrxPDFExport cause GDI Handles leak when runing in thread
Hi,
I have problem with memory leaks in TfrxPDFExport. My application create some reports and export it to pdf in one separated thread. I prepare simple application to demonstrate problem.
When I run this code in main thread everything is ok.
frxReport1->PreviewPages->LoadFromFile("Test.fp3");
frxPDFExport1->FileName = "Test.pdf";
for(int i=0; i<1000; ++i)
{
frxReport1->PreviewPages->Export(frxPDFExport1);
}
When I run above code in thread the private bytes and GDI Handles starts to grow.
Especially when I start to manually move or resize application windows.
It's probably because pdf export not properly uses canvas.
Any help appreciated.
Best regards,
macma
I have problem with memory leaks in TfrxPDFExport. My application create some reports and export it to pdf in one separated thread. I prepare simple application to demonstrate problem.
When I run this code in main thread everything is ok.
frxReport1->PreviewPages->LoadFromFile("Test.fp3");
frxPDFExport1->FileName = "Test.pdf";
for(int i=0; i<1000; ++i)
{
frxReport1->PreviewPages->Export(frxPDFExport1);
}
When I run above code in thread the private bytes and GDI Handles starts to grow.
Especially when I start to manually move or resize application windows.
It's probably because pdf export not properly uses canvas.
Any help appreciated.
Best regards,
macma
Comments
Ok I found reason of the problem:
It's in frxExportPDF.pas line 2737:
TempBitmap.Width := Round(dx * i) + i;
TempBitmap.Height := Round(dy * i) + i;
Obj.Draw(TempBitmap.Canvas, i, i, -Round((Obj.AbsLeft - fdx) * i) + iz, -Round((Obj.AbsTop - fdy)* i));
Should be:
TempBitmap.Canvas.Lock;
try
Obj.Draw(TempBitmap.Canvas, i, i, -Round((Obj.AbsLeft - fdx) * i) + iz, -Round((Obj.AbsTop - fdy)* i));
finally
TempBitmap.Canvas.Unlock;
end;
Is there someone from FastRepost Team that could confirm and fix this error in current version?
PS.
At first glance I see that there is more GDI issues in other exports too.
Best regards,
macma