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

Delphi XE2, 64-bit, RB 14.03. EAccessViolation on preview of a report

edited March 2012 in General
Hello everybody,

Attempt to preview a report fails with the EAccessViolation exception in
ppDBPipe.TppDBPipeline.GotoBookmark.

The call stack for this error is the following:

System.InterlockedIncrement(Opt.out)
System._DynArrayAddRef(???)
System._DynArrayAsg(nil,???,???)
ppDBPipe.TppDBPipeline.GotoBookmark(-17300544)
ppEngine.TppEngine.DataPipelineRecToState((False, False, False,
True, -17300544, 0, 0),$7FFFFF42790,True)
ppEngine.TppEngine.RequestPage($7FFFEF82940)
ppReport.TppReport.RequestPage($7FFFEF919E0,$7FFFEF82940)
ppDevice.TppPublisher.DoOnPageRequest
ppDevice.TppPublisher.Publish
ppDevice.TppDevice.MakePageRequest
ppThreadedPageCache.TppPageRequestThread.ExecuteReport
ppThreadedPageCache.TppPageRequestThread.Execute
System.Classes.ThreadProc($7FFFF40F990)
System.ThreadWrapper($7FFFEFA7560)
:000000007696652D ; C:\Windows\system32\kernel32.dll
:0000000076F0C521 ; ntdll.dll

The cause of the problem is that a bookmark is a dynamic array of bytes but
the guys from Digital Metaphors treat it as a LongInt value (or NativeInt, I
don't remember?). I checked what is returned by the TDataSet.GetBookmark.

Data.DB.TDataSet.GetBookmark /// RETURNS A TBookmark value. TBookmark =
TBytes; This particular call returns 20 bytes long array.
ppDBPipe.TppDBPipeline.GetBookmark
ppEngine.TppEngine.DataPipelineStateToRec($7FFFFF42FD0,(False, False, False,
True, 0, 0, 0))
ppEngine.TppEngine.RequestPage($7FFFEE72570)
ppReport.TppReport.RequestPage($7FFFEF69BD0,$7FFFEE72570)
ppDevice.TppPublisher.DoOnPageRequest
ppDevice.TppPublisher.Publish
ppDevice.TppDevice.MakePageRequest
ppThreadedPageCache.TppPageRequestThread.ExecuteReport
ppThreadedPageCache.TppPageRequestThread.Execute
System.Classes.ThreadProc($7FFFF411590)
System.ThreadWrapper($7FFFED74630)
:000000007696652D ; C:\Windows\system32\kernel32.dll
:0000000076F0C521 ; ntdll.dll

In RBuilder bookmark is stored and managed as a LongInt or NativeInt value
which is totally wrong. I tried to fix the bug but I found that there are
too many places where such false assumption is made. Bookmarks are stored
into packed records and saved|restored to|from cache streams.

I have two questions also.

1. Have you ever run RB 14.03 from a 64-bit app?
2. Are you sure that the installation of RB 14.03 includes the latest
sources?

Comments

  • edited March 2012
    We have tested ReportBuilder with the 64-bit compiler. However, errors are
    not always easy to find. For example, if at run-time a pointer value is
    small enough to fit into a 32-bit integer, then an error will not occur when
    Integer is used rather than NativeInt.

    I setup a test case using RB, ADO, SQL Server and DBGRid. I did not
    encounter the error you are reporting. However from reviewing the code, I
    can see the issue is caused by some remaining references to LongInt rather
    than NativeInt. This will be fixed for the next maintenance release, thanks
    for reporting it.

    Originally VCL declared TBookmark as Pointer. Delphi 2009 introduced Unicode
    VCL and with it came the introduction of TBytes, a dynamic array of bytes,
    and thus memory managed. Evidently the Delphi team decided the memory
    management benefit out weighed breaking customer's existing code and decided
    to declare TBookmark as TBytes.

    For ReportBuilder's DataPipeline we used Integer to store bookmarks, this
    worked best for supporting the descendants: DBPipeline, JITPipeline,
    TextPipeline. For Delphi 2009 we introduced some internal logic to
    DBPipeline to allow boomarks to continue working as they always have. For
    Delphi XE2 64-bit the intent is to change from Integer to NativeInt.

    -
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited March 2012
    "Nard Moseley (Digital Metaphors)" wrote in message
  • edited March 2012
    Thanks for the feedback. Those mods, plus some others will be included in
    the next maintenance release. It's hard to find all the errors, your help is
    appreciated.

    -
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.