Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Access Violation when closing Custom Preview to soon

Hello,

I want to use the unit rbPrvDlg for custom Previewer.
I have not changed the unit.
Every time I close the Previewer to soon (before the report is generated) with the x (right above), madException kicks in and reports an Access Violation. Is there a way to avoid this?

kind regards,

Dirk Janssens.

Comments

  • Hi Dirk,

    The TppPrintPreview.FormClose method is called when an attempt is made to close the form. The event-handler code prevents the form from being close when Viewer.Busy (which internally returns false if the report engine is busy).

    We are not receiving reports of AV's and this code has been in place for a long time. I think in real world use this implementation is working.

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • Hi Nard,
    If I disable MadExcept, I do not have a problem. But I was adviced to look into into it. Do you think I can ignore this? Or is there something wrong in my code which causes the AV?
  • I just made a little demo which I hope replicates the error I have in my "real world" application.
    It really is very simple, a few lines of code.
    The application freezes if i click on the x to close the preview, before the reports is completely generated. I cannot trace the exact location. Even madExcept does not kick in... strange...

    after " ppReport1.Print ;" , the preview appears, and while rendering, I click on the x.

    no changes made to rbPrvDlg

    The report is on the form,and is simple, but has some code to simulate a little complexity.

    Do you need the project? Or is this enough information?
  • Hi Dirk,

    Does this also occur if you use the Preview toolbar Cancel/Close button?

    I tested yesterday and again today, but I cannot produce an AV.

    Please create a simple example project I can build and run in the debugger. Use standard Delphi components and RB. Send in zip format to support@


    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • "Does this also occur if you use the Preview toolbar Cancel/Close button?"
    No, only with alt-F4 or the 'x' right above. I ll send you the project...
Sign In or Register to comment.