View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0018660 | Lazarus | LCL | public | 2011-02-02 06:27 | 2017-06-01 11:21 |
Reporter | cobines | Assigned To | Jesus Reyes | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | Win32 | OS | Windows XP | ||
Product Version | 0.9.31 (SVN) | ||||
Target Version | 0.9.30 | Fixed in Version | 0.9.31 (SVN) | ||
Summary | 0018660: TCustomGrid.ScrollToCell may go into infite loop | ||||
Description | I have found that my program hangs in ScrollToCell. Unfortunately I cannot reproduce it in a small sample, but I have attached a log when compiled with "dbgGridScroll". From it you can see that Xinc is -1 at some point in the loop, then next turn it is 1, then -1, and again 1, etc. So it adds and substracts value of 1 indefinitely. This started happening I think after commit 29202, so it is a regression from 0.9.28. The grid has: - Flat=True - FixedCols=0 - FixedRows=1 - ColCount = 5 - RowCount = 21 - Options := [goFixedVertLine, goFixedHorzLine, goTabs, goRowSelect, goColSizing, goThumbTracking, goSmoothScroll]; In the program I do: aGrid.RowCount := 21; aGrid.Row := 3; <- here it hangs I'm hoping this might be enough information. Here is the log: aCol=0 aRow=3 FixHeight=22 CHeight=87 FixWidth=0 CWidth=201 TL.C=0 TL.R=1 RNew:L=1 T=67 R=251 B=89 Xinc=1 YInc=1 ColOff=0 RowOff=0 TL.C=1 TL.R=2 RNew:L=-249 T=45 R=1 B=67 Xinc=-1 YInc=0 ColOff=0 RowOff=0 TL.C=0 TL.R=2 RNew:L=1 T=45 R=251 B=67 Xinc=1 YInc=0 ColOff=0 RowOff=0 TL.C=1 TL.R=2 RNew:L=-249 T=45 R=1 B=67 Xinc=-1 YInc=0 ColOff=0 RowOff=0 TL.C=0 TL.R=2 RNew:L=1 T=45 R=251 B=67 Xinc=1 YInc=0 ColOff=0 RowOff=0 TL.C=1 TL.R=2 RNew:L=-249 T=45 R=1 B=67 Xinc=-1 YInc=0 ColOff=0 RowOff=0 TL.C=0 TL.R=2 RNew:L=1 T=45 R=251 B=67 Xinc=1 YInc=0 ColOff=0 RowOff=0 TL.C=1 TL.R=2 RNew:L=-249 T=45 R=1 B=67 Xinc=-1 YInc=0 ColOff=0 RowOff=0 TL.C=0 TL.R=2 RNew:L=1 T=45 R=251 B=67 Xinc=1 YInc=0 ColOff=0 RowOff=0 TL.C=1 TL.R=2 RNew:L=-249 T=45 R=1 B=67 Xinc=-1 YInc=0 ColOff=0 RowOff=0 Last two lines continue indefinitely. | ||||
Tags | No tags attached. | ||||
Fixed in Revision | 29406 | ||||
LazTarget | 0.9.30 | ||||
Widgetset | |||||
Attached Files |
|
related to | 0031942 | resolved | Ondrej Pokorny | TCustomGrid.ScrollToCell may go into infinite loop (still? again?) |
|
In commit 29202 there was added "+GetBorderWidth" to two places where FGCache.FixedWidth is used, but two other places were not changed. If I do the following the program doesn't hang anymore. Index: grids.pas =================================================================== --- grids.pas (revision 29309) +++ grids.pas (working copy) @@ -3125,7 +3125,7 @@ if RNew.Left >= CWidth then Xinc := 1 // hidden at the right of clientwidth line else - if (RNew.Left > FGCache.FixedWidth) and + if (RNew.Left > FGCache.FixedWidth+GetBorderWidth) and (RNew.Left < CWidth) and (CWidth < RNew.Right) then begin Xinc := 1; // partially visible at the right FGCache.TLColOff := 0; // cancel col-offset for next calcs @@ -3138,7 +3138,7 @@ if (RNew.Top >= CHeight) then YInc := 1 // hidden at the bottom of clientheight line else - if (RNew.Top > FGCache.FixedHeight) and + if (RNew.Top > FGCache.FixedHeight+GetBorderWidth) and (RNew.Top < CHeight) and (CHeight < RNew.Bottom) then begin Yinc := 1; // partially visible at bottom FGCache.TLRowOff := 0; // cancel row-offset for next calcs Could this be the reason? |
|
Regression, so 0.9.30 |
2011-02-06 05:51
|
|
|
I have managed to reproduce with a sample project. It is attached. |
|
I think your patch is correct. In this case should also include GetBorderWidth (in Flat case). |
|
applied thanks |
|
OK, thanks. |
Date Modified | Username | Field | Change |
---|---|---|---|
2011-02-02 06:27 | cobines | New Issue | |
2011-02-02 06:52 | cobines | Note Added: 0045686 | |
2011-02-02 07:51 | Zeljan Rikalo | Status | new => assigned |
2011-02-02 07:51 | Zeljan Rikalo | Assigned To | => Jesus Reyes |
2011-02-02 08:42 | Zeljan Rikalo | LazTarget | => 0.9.30 |
2011-02-02 08:42 | Zeljan Rikalo | Note Added: 0045691 | |
2011-02-06 05:51 | cobines | File Added: grid_scrolltocell_hang.zip | |
2011-02-06 05:52 | cobines | Note Added: 0045838 | |
2011-02-06 13:43 | Tomasz Wieckowski | Note Added: 0045847 | |
2011-02-07 08:02 | Jesus Reyes | Fixed in Revision | => 29406 |
2011-02-07 08:02 | Jesus Reyes | Status | assigned => resolved |
2011-02-07 08:02 | Jesus Reyes | Fixed in Version | => 0.9.31 (SVN) |
2011-02-07 08:02 | Jesus Reyes | Resolution | open => fixed |
2011-02-07 08:02 | Jesus Reyes | Note Added: 0045858 | |
2011-02-07 08:02 | Jesus Reyes | Target Version | => 0.9.30 |
2011-02-08 06:21 | cobines | Status | resolved => closed |
2011-02-08 06:21 | cobines | Note Added: 0045888 | |
2017-06-01 11:21 | Juha Manninen | Relationship added | related to 0031942 |