AdvGrid Access Violations

I consistently see clients getting an access violation from AdvGrid but I have been unable to trace the origin of the problem. I have MadExcept and I'm getting a call stack but in this case, there isn't any of my code in the stack.

I am just putting this out there in hopes that someone might have suggestions on where I should look to find the root of the problem.


exec. date/time    : 2022-06-10 08:27
version            : 2022.6.1.516
compiled with      : Delphi 10.1 Berlin
madExcept version  : 4.0.21
database name      : tracks
database provider  : SQLNCLI10
institution        : Fort Worth Zoological Park
callstack crc      : $0a00007c, $9fc2b91e, $ecca2d82
count              : 2
exception number   : 2
exception class    : EAccessViolation
exception message  : Access violation at address 0A00007C. Write of address 0AB2A0C5.

main thread ($2404):
0a00007c ???
005a6fb7 tracks.exe   Vcl.Graphics              TBitmap.Draw
005a0beb tracks.exe   Vcl.Graphics              TCanvas.Draw
009ad20f tracks.exe   AdvGrid        34030 +440 DrawCellGraphic
009b2f69 tracks.exe   AdvGrid        36062 +646 TAdvStringGrid.DrawGridCell
008db398 tracks.exe   BaseGrid         709 +236 TBaseGrid.PaintCellInt
008db41e tracks.exe   BaseGrid         728   +1 TBaseGrid.DrawCell
009a51af tracks.exe   AdvGrid        30682   +1 TAdvStringGrid.DrawCell
007c1310 tracks.exe   Vcl.Grids       1053   +0 DrawCells
007c1d28 tracks.exe   Vcl.Grids       1053   +0 TCustomGrid.Paint
008daaf9 tracks.exe   BaseGrid         435   +1 TBaseGrid.Paint
009a3d95 tracks.exe   AdvGrid        30105  +12 TAdvStringGrid.Paint
005de70f tracks.exe   Vcl.Controls              TCustomControl.PaintWindow
005d856d tracks.exe   Vcl.Controls              TWinControl.PaintHandler
009b833e tracks.exe   AdvGrid        38414  +10 TAdvStringGrid.WMPaint
005d3856 tracks.exe   Vcl.Controls              TControl.WndProc
005d83a1 tracks.exe   Vcl.Controls              TWinControl.WndProc
009ee16b tracks.exe   AdvGrid        59475 +696 TAdvStringGrid.WndProc
005d79c0 tracks.exe   Vcl.Controls              TWinControl.MainWndProc
0054d3f0 tracks.exe   System.Classes            StdWndProc
77a74e9b ntdll.dll                              KiUserCallbackDispatcher
763a136a win32u.dll                             NtUserDispatchMessage
77427e5b user32.dll                             DispatchMessageW
006f21e7 tracks.exe   Vcl.Forms                 TApplication.ProcessMessage
006f222a tracks.exe   Vcl.Forms                 TApplication.HandleMessage
006f255d tracks.exe   Vcl.Forms                 TApplication.Run
02e64123 tracks.exe   tracks          1038  +19 initialization

Seems to be in cell graphics drawing.
Do you use the latest version and how do you use cell graphics?

Thanks, Bruno, I agree. I just can't figure out what the issue is. I don't have any drawing events and I never draw directly on the canvas. The grid does sometimes include a column that has thumbnail images, but that just uses the built-in rendering.

The events on that grid are: OnClickSort, OnColumnMoved, OnDblClick, OnGetCellColor, OnGetFormat, OnRawCompare, OnSelectionChanged.

The error seems to happen when the grid either becomes visible or loses visibility (it's on a page control. it's always there but the error only happens when that page is coming in or out of visibility)

The thing that is so unusual to me is that the code dump doesn't include any of my code. It seems like something internal is causing the error.

As with all really juicy bugs, I struggle to reproduce it. However, I see it happening with clients frequently and it's in their log files.

I'm currently on TAdvStringGrid v8.5.2.1

First of all, the latest version of TAdvStringGrid is v8.6.14.4.
From your description, possibly, you are destroying images first before the grid is destroyed and the grid is in this phase maybe still referencing destroyed images?