View Issue Details

IDProjectCategoryView StatusLast Update
0022873LazarusLCLpublic2012-10-18 01:32
ReporterTristan Linnell Assigned ToJesus Reyes  
Status resolvedResolutionfixed 
Product Version1.0.0 
Target Version1.2.0Fixed in Version1.1 (SVN) 
Summary0022873: SIGSEGV on scrolling TDBGrid
DescriptionIn our case, this bug can be reproduced 100% of the time, however we have been unable to reproduce it in a controlled test application.

The issue manifests itself as follows:

We have a TDBGrid with several columns and rows. There are more columns than can fit on the screen, so that horizontal scroll bars are visible.

To reproduce the bug, we open the application, Click on the right side of the horizontal scroll bar at the bottom, once.

If the mousewheel is then scrolled down, a SIGSEGV occurs on Line 1783 of DBGrids.pas. Upon debugging, the line

result := ColumnFromGridColumn(aCol).ButtonStyle;

is attempting to retrieve ButtonStyle from a nil pointer.

A patch is provided which checks for correct assignment of this TGridColumn in TCustomDBGrid.ColumnEditorStyle, leaving the result at the default if the pointer is nil.

This patch fixes the symptoms of the bug.
Additional InformationHave reproduced on Win32 and Carbon widgetsets, with identical results.
Patch fixes issue on both.
TagsNo tags attached.
Fixed in Revision39118
Attached Files


2012-09-13 13:33


dbgridscrollcrash.diff (619 bytes)   
Index: lcl/dbgrids.pas
--- lcl/dbgrids.pas	(revision 38415)
+++ lcl/dbgrids.pas	(working copy)
@@ -1777,10 +1777,13 @@
 function TCustomDBGrid.ColumnEditorStyle(aCol: Integer; F: TField): TColumnButtonStyle;
+  gridcol: TGridColumn;
   result := cbsAuto;
-  if Columns.Enabled then
-    result := ColumnFromGridColumn(aCol).ButtonStyle;
+  gridcol := ColumnFromGridColumn(aCol);
+  if Columns.Enabled and Assigned(gridcol) then
+    result := gridcol.ButtonStyle;
   result := DefaultEditorStyle(result, F);
dbgridscrollcrash.diff (619 bytes)   

Shaun Simpson

2012-09-26 17:17

reporter   ~0062650

I too have had this issue.
Thank you for the patch is solved it for me.

Jesus Reyes

2012-10-18 01:32

developer   ~0063250

Applied, thank you.

I suggested this patch to be merged into 1.0.4

Issue History

Date Modified Username Field Change
2012-09-13 13:33 Tristan Linnell New Issue
2012-09-13 13:33 Tristan Linnell File Added: dbgridscrollcrash.diff
2012-09-13 13:33 Tristan Linnell Widgetset => Win32/Win64
2012-09-26 17:17 Shaun Simpson Note Added: 0062650
2012-09-27 07:37 Zeljan Rikalo Status new => assigned
2012-09-27 07:37 Zeljan Rikalo Assigned To => Jesus Reyes
2012-10-18 01:32 Jesus Reyes Fixed in Revision => 39118
2012-10-18 01:32 Jesus Reyes LazTarget => 1.2
2012-10-18 01:32 Jesus Reyes Status assigned => resolved
2012-10-18 01:32 Jesus Reyes Fixed in Version => 1.1 (SVN)
2012-10-18 01:32 Jesus Reyes Resolution open => fixed
2012-10-18 01:32 Jesus Reyes Note Added: 0063250
2012-10-18 01:32 Jesus Reyes Target Version => 1.2.0