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

Access violation when closing report during generation

edited May 2010 in General
I'm still new to working with ReportBuilder but we've experienced an issue
where users are clicking the close button while a large report is being
generated, resulting in an access violation.

Is there a clean way of preventing or handling this exception?

Using Delphi 2007 with ReportBuilder 11.08.

Thanks in advance,

A.J. van de Ven

Comments

  • edited May 2010
    > Is there a clean way of preventing or handling this exception?

    I have cancelled reports during generation and not received an AV.

    Do you at least have a call stack? (It may or may not provide clues).

    Ed Dressel
    Team DM
  • edited June 2010
    Hi A.J.,

    As Ed mentioned, are you able to check your call stack and trace into the RB
    source and see where the exception is occurring? We are not aware of any
    specific issues that occur when closing a report so any information you can
    give us would be very helpful in tracking it down.

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited June 2010
    We've asked our support department to recreate it and they're able to by
    closing the application itself when the report is being generated.

    I did as you suggested and looked at the call stack generated by
    madException (see below) but don't see anything that gives an indication of
    where the problem is occurring other than the exception message itself.

    Perhaps we need to cancel the report generation as soon as the user clicks
    the application's close button?

    compiled with : Delphi 2006/07
    madExcept version : 3.0k
    callstack crc : $8a3865db, $0f13b540, $0dfc8d4a
    exception number : 1
    exception class : EInvalidOperation
    exception message : Control '' has no parent window.

    Main ($1654):
    004caadf +0a7 MyApp.exe Controls 6750 +9 TWinControl.CreateWnd
    0049f725 +005 MyApp.exe StdCtrls 3791 +1 TButton.CreateWnd
    004caf46 +016 MyApp.exe Controls 6883 +3 TWinControl.CreateHandle
    00613b07 +017 MyApp.exe cxButtons TcxCustomButton.CreateHandle
    004ce970 +01c MyApp.exe Controls 8894 +4 TWinControl.HandleNeeded
    004ce97d +005 MyApp.exe Controls 8900 +1 TWinControl.GetHandle
    00613398 +0ac MyApp.exe cxButtons TcxCustomButton.MouseUp
    004c86f4 +02c MyApp.exe Controls 5355 +2 TControl.DoMouseUp
    004c8776 +076 MyApp.exe Controls 5367 +8 TControl.WMLButtonUp
    004c7a78 +024 MyApp.exe Controls 5021 +5 TControl.Perform
    004c7deb +2bb MyApp.exe Controls 5146 +83 TControl.WndProc
    004cbde3 +4fb MyApp.exe Controls 7304 +111 TWinControl.WndProc
    0049f4f4 +06c MyApp.exe StdCtrls 3684 +13 TButtonControl.WndProc
    006127c6 +06e MyApp.exe cxButtons TcxCustomButton.WndProc
    004cb50c +02c MyApp.exe Controls 7073 +3 TWinControl.MainWndProc
    0047f86c +014 MyApp.exe Classes 11583 +8 StdWndProc
    76b08b77 +00a USER32.dll DispatchMessageA
    004e888c +0fc MyApp.exe Forms 8105 +23 TApplication.ProcessMessage
    004e88c6 +00a MyApp.exe Forms 8124 +1 TApplication.HandleMessage
    004e8bbb +0b3 MyApp.exe Forms 8223 +20 TApplication.Run
    012813af +347 MyApp.exe MyApp 170 +43 initialization
    76a5d0e7 +010 kernel32.dll BaseThreadInitThunk

  • edited June 2010
    > exception message : Control '' has no parent window.

    that's not an AV :-)--- but I have always related that exception to using
    Dev Express controls (which I use extensively) though I have not seen it in
    a while. I have never seen it with RB.

    If you are closing the app, how are you telling it to close? Also, did you
    cancel the report generation before closing the application?

    Ed Dressel
    Team DM
  • edited June 2010
    Besides setting some variables, this is how we close the application:

    for i := 0 to MDIChildCount - 1 do
    begin
    MDIChildren[0].Close;
    Application.ProcessMessages;
    end;

    Currently, we don't cancel the report generation prior to closing the
    application.

    However, we do set a variable ShuttingDown := True. We use this in a number
    of places, such as form-specific OnActivate and OnClose routines, to prevent
    certain actions from taking place if the software is being closed.


  • edited June 2010
    > for i := 0 to MDIChildCount - 1 do


    This is similar to what I use to do but I took it over the chin a few times
    by other users for calling the .ProcessMessages. I've been told that it is
    not a good idea, and removing it has fixed various issues in my application.

    I would recommend changing that to something like:

    for I := MDICHildCount-1 downto 0 do
    PostMessage(MDICHildren[I].Handle, WM_CLOSE, 0, 0);

    that may take care of the problem, but you will have to test.

    Ed Dressel
  • edited June 2010
    Thanks, Ed.

    We'll give it a shot and see what happens.

    Doing so permantently will require quite a bit of testing, but we'll
    definitely look into it.

  • edited June 2010
    > Doing so permantently will require quite a bit of testing, but we'll

    Definately. Best wishes

    Ed Dressel
This discussion has been closed.