View Issue Details

IDProjectCategoryView StatusLast Update
0017426LazarusLCLpublic2011-12-01 11:24
ReporterSławomir ZałęckiAssigned ToJesus Reyes 
PrioritynormalSeveritycrashReproducibilityalways
Status closedResolutionfixed 
Product Version0.9.28.3 (SVN)Product Build 
Target Version0.9.30Fixed in Version0.9.29 (SVN) 
Summary0017426: Exception in grids.pas in TCustomGrid.ResetHotCell. Bug in TCustomGrid.Clear?
DescriptionMy application (in the context menu) saves the grid to a file and reads the grid from file. When I read the data from the grid I use the following code:
  Columns.Clear;
  Clear;
  LoadFromFile(fname);

The second time ever I get an error when you move the mouse.
My project raised exception class 'EListError' with message: List index (-1) out of bounds
Additional InformationI was looking for a long time causes.
In my opinion bug is in procedure TCustomGrid.Clear;
in this procedure is:
  FGCache.HotCell := Point(-1, -1);
should be:
  FGCache.HotCellPainted := false;
  FGCache.HotCell := Point(-1, -1);
or better:
  FGCache.HotCellPainted := false;
  ResetHotCell;

Details:
Then only FGCache.HotCell := Point(-1, -1) then sometimes value FGCache.HotCellPainted remains true.
Next if will be called HeadersMouseMove
and next
  if (gz<>HotGridZone) or (P.x<>HotCell.x) or (P.y<>HotCell.y) then begin
    ResetHotCell; //in HeadersMouseMove
and next
  if HotCellPainted then //HotCellPainted is true(!) and HotCell = (-1,-1)
    InvalidateCell(HotCell.X, HotCell.Y);
and next
  R:=CellRect(aCol, aRow); //in InvalidateCell (aCol, aRow = -1 (!))
and next
  ColRowToOffset(True, True, ACol, Result.Left, Result.Right); //in CellRect
and next
  StartPos:=integer(PtrUInt(AccumWidth[index])); //in ColRowToOffset; index = -1
then
  raised exception class 'EListError'
TagsNo tags attached.
Fixed in Revision27387
LazTarget0.9.30
WidgetsetGTK 2
Attached Files

Activities

Jesus Reyes

2010-09-16 19:07

developer   ~0041140

I couldn't reproduce the problem with the information provided, next time please attach a sample project.

However I think the patch it's good so I applied it. Thank you.

Sławomir Załęcki

2010-09-16 19:48

reporter   ~0041141

I had no time to prepare the sample application.
I lost a whole day of looking for cause of the problem, because I thought that the problem is with my application.

Now everything works fine. Thank you very much!

Issue History

Date Modified Username Field Change
2010-09-16 09:27 Sławomir Załęcki New Issue
2010-09-16 09:27 Sławomir Załęcki Widgetset => GTK 2
2010-09-16 17:21 Jesus Reyes Status new => assigned
2010-09-16 17:21 Jesus Reyes Assigned To => Jesus Reyes
2010-09-16 19:07 Jesus Reyes Fixed in Revision => 27387
2010-09-16 19:07 Jesus Reyes LazTarget => 0.9.30
2010-09-16 19:07 Jesus Reyes Status assigned => resolved
2010-09-16 19:07 Jesus Reyes Fixed in Version => 0.9.29 (SVN)
2010-09-16 19:07 Jesus Reyes Resolution open => fixed
2010-09-16 19:07 Jesus Reyes Note Added: 0041140
2010-09-16 19:07 Jesus Reyes Target Version => 0.9.30
2010-09-16 19:48 Sławomir Załęcki Note Added: 0041141
2011-12-01 11:24 Marc Weustink Status resolved => closed