Thread Safe

al_nolandal_noland Tulsa, Oklahoma
edited 8:43AM in FastReport 4.0
Is Fast Report 4 Thread Safe? Are there any special properties I need to set when using FR from threads?

Comments

  • edited 8:43AM
    al_noland wrote: »
    Is Fast Report 4 Thread Safe? Are there any special properties I need to set when using FR from threads?
    Yes, it's Thread Safe.

    Create a report object inside thread and set this property:
    frxReport.EngineOptions.EnableThreadSafe := True;
    frxReport.EngineOptions.DestroyForms := False;
    frxReport.EngineOptions.ReportThread := Thread;
  • al_nolandal_noland Tulsa, Oklahoma
    edited 8:43AM
    wrote: »
    wrote: »
    Is Fast Report 4 Thread Safe? Are there any special properties I need to set when using FR from threads?
    Yes, it's Thread Safe.

    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.
  • A note to hopefully help others. When creating the report component within the thread like so:

    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.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.