You are not logged in.
Pages: 1
This seems to do the trick! Tomorrow I do some more testing to be absolutely sure.
Thanks you so much.
The runtime error is raised before reaching the TPrintPreview.Destroy and TPaperPreview.Destroy breakpoints.
TGDIPlusSubset.Destroy is executed before the SynPDF, SynCrypto, SynCommons and SynGDI finalization.
I made a small video showing the debugging. The runtime error itself isn't shown because only the Delphi Environment window was captured.
http://173.236.46.37/Runtime216.mp4
Thanks for your suggestion.
It didn't solve the problem.
Debugging learns me that Startup(fToken,Input,fStartupHook) = stOk. This begin-end block is not executed.
I distributed the application on a Windows 7, same problem.
Yesterday I posted my question on the DelphiArea forum but no answer yet.
My application is a VCL Forms application.
I din't try mORMotReport.pas since I'm using Print Preview for many years now. I prefer to keep using Print Preview if possible.
I changed the finalization without success.
If I debug trace into (F7) the finalization I enter the TGDIPlus.Destroy destructor.
fStartupHook.UnHook(fStartupHookToken) is the command that causes the problem.
destructor TGDIPlus.Destroy;
begin
if fToken<>0 then begin
if Assigned(fStartupHook.UnHook) then // may be nil e.g. for Win64
fStartupHook.UnHook(fStartupHookToken);
Shutdown(fToken);
fToken := 0;
end;
UnLoad;
inherited Destroy;
end;
Thanks for your help.
I'm using the PDF engine together with the "Print Preview" component (DelphiArea.com website).
I included the {$DEFINE SYNOPSE} compiler directive in the project options.
This should be enough for the Print Preview component to take care of everything if I understood correctly.
In my own project units I don't have any link to SynPDF.
Printing a PDF works fine, the error occurs after closing the application.
If I remove the compiler directive (in other words, when I don't use the PDF engine), no error occurs.
Where should I put the "FreeAndNil(Gdip)"?
Hi,
using Delphi XE and SynPDF v1.18 on Windows 10:
PDF creation works fine but after closing my application I get runtime error 216.
I traced it down to the finalization of unit SynGdiPlus.
finalization
Gdip.Free;
Windows.DeleteCriticalSection(GdipCS);
end.
Gdip.Free causes the problem, so Windows.DeleteCriticalSection(GdipCS) is skipped when debugging.
Any help appreciated.
Regards,
Tom
Pages: 1