Thread Safe
al_noland
Tulsa, Oklahoma
Is Fast Report 4 Thread Safe? Are there any special properties I need to set when using FR from threads?
Comments
Create a report object inside thread and set this property:
frxReport.EngineOptions.EnableThreadSafe := True;
frxReport.EngineOptions.DestroyForms := False;
frxReport.EngineOptions.ReportThread := Thread;
Thanks for the reply.
FReport := TfrxReport.Create( nil );
FReport.EngineOptions.EnableThreadSafe := true;
FReport.EngineOptions.DestroyForms := false;
FReport.EngineOptions.ReportThread := self;
I recieved an access violation when closing down the application creating the thread. The Report component itself was destroyed earlier in the code. I did find my misstake I think, and make a note on that here to help others.
I created and destroyed the component in the thread's creator and destructor rather than within the Execute of the thread. When you're in the constructor of the thread, your still in the scope of the main or calling process, not the thread itself. You should always create and destroy the report component within the Execute of the thread.
Hope that helps someone.