View Issue Details

IDProjectCategoryView StatusLast Update
0001857Double CommanderDefaultpublic2020-11-30 07:44
Reporternicker Assigned ToAlexx2000  
PriorityhighSeverityblockReproducibilityalways
Status closedResolutionfixed 
ProjectionnoneETAnone 
Product Version1.0.0 (trunk) 
Target Version0.8.1Fixed in Version0.8.1 
Summary0001857: Infinite loop caused by TCustomGrid
DescriptionWhen saving a file while in thumbnail view an infinite loop may occur.
There are also cases where the infinite loop occurs just by leaving the double commander open in thumbnail view.

This is related also to the specific layout, the size of the window and the size of the thumbnail, in my case all set to default on a QHD display (2560x1440).

I've added the call stack under the 'Additional Information field.
The loop occurs in the function TCustomGrid.ScrollToCell at c:\lazarus\lcl\grids.pas line 3326



Steps To Reproduce1. Navigate to a folder with several dozens of images.
1. Switch to thumbnail view.
2. Select an arbitrary image file.
3. Change the window size of double commander to 1200x800
4. Minimize double commander
5. Edit and save the selected image file using an external image editor.
6. Restore double commander.
Additional InformationCALLSTACK

#0 SCROLLTOCELL(0xcb78400, 3, 0, false) at grids.pas:3340
0000001 MOVEEXTEND(0xcb78400, false, 3, 0) at grids.pas:7175
#2 SETCOL(0xcb78400, 3) at grids.pas:2963
#3 SETACTIVEFILE(0xcb3dc60, 3) at fileviews\ufileviewwithgrid.pas:691
#4 SETUPDATE(0x64cf89c, 3) at fileviews\uorderedfileview.pas:768
#5 SETACTIVEFILENOW(0xcb3dc60, 0xcd95c6c 'd:\Winslow\zmisc\PhotoShop\shani.psd') at fileviews\uorderedfileview.pas:784
#6 DISPLAYFILELISTCHANGED(0xcb3dc60) at fileviews\ufileviewwithgrid.pas:511
#7 HANDLENOTIFICATIONS(0xcb3dc60) at fileviews\ufileview.pas:3091
#8 NOTIFY(0xcb3dc60, [FVNDISPLAYFILELISTCHANGED, FVNFILESOURCEFILELISTUPDATED]) at fileviews\ufileview.pas:3143
0000009 ADDFILE(0xcb3dc60, 0x168b8374 'ps163A.tmp', 0xcd48dc4 'd:\Winslow\zmisc\PhotoShop', NFPSORTEDPOSITION, UFPNOCHANGE) at fileviews\ufileview.pas:1059
0000010 HANDLEFSWATCHEREVENT(0xcb3dc60, {PATH = 0xcd48dc4 'd:\Winslow\zmisc\PhotoShop', EVENTTYPE = FSWFILECREATED, FILENAME = 0x168b8374 'ps163A.tmp', NEWFILENAME = 0x0, USERDATA = 0x0}, NFPSORTEDPOSITION, UFPNOCHANGE) at fileviews\ufileview.pas:3264
0000011 WATCHEREVENT(0xcb3dc60, {PATH = 0xcd48dc4 'd:\Winslow\zmisc\PhotoShop', EVENTTYPE = FSWFILECREATED, FILENAME = 0x168b8374 'ps163A.tmp', NEWFILENAME = 0x0, USERDATA = 0x0}) at fileviews\ufileview.pas:3337
0000012 DOWATCHEREVENT(0x688e3e8) at platform\ufilesystemwatcher.pas:790
0000013 CLASSES_$$_EXECUTETHREADQUEUEENTRY$TThread.PTHREADQUEUEENTRY at :0
0000014 CLASSES_$$_CHECKSYNCHRONIZE$LONGINT$$BOOLEAN at :0
0000015 DOWINDOWPROC(0x6823bf8) at win32\win32callback.inc:1962
0000016 WINDOWPROC(2565134, 0, 0, 0) at win32\win32callback.inc:2604
0000017 USER32!AddClipboardFormatListener at :0
0000018 USER32!DispatchMessageW at :0
0000019 USER32!DispatchMessageW at :0
0000020 USER32!DispatchMessageW at :0
0000021 APPPROCESSMESSAGES(0x6891420) at win32\win32object.inc:366
0000022 HANDLEMESSAGE(0x6839820) at include\application.inc:1262
0000023 RUNLOOP(0x6839820) at include\application.inc:1399
0000024 APPRUN(0x6891420, {Proc = {procedure (POINTER)} 0x64cfee8, Self = 0x6839820}) at include\interfacebase.inc:54
0000025 RUN(0x6839820) at include\application.inc:1387
0000026 main at doublecmd.lpr:199
TagsNo tags attached.
Attached Files
bug1857.patch (2,112 bytes)   
Index: src/fileviews/ucolumnsfileview.pas
===================================================================
--- src/fileviews/ucolumnsfileview.pas	(revision 7616)
+++ src/fileviews/ucolumnsfileview.pas	(working copy)
@@ -38,7 +38,9 @@
     procedure SetGridVertLine(const AValue: Boolean);
 
   protected
+    {$IF lcl_fullversion < 1090000}
     function SelectCell(aCol, aRow: Integer): Boolean; override;
+    {$ENDIF}
     procedure KeyDown(var Key: Word; Shift: TShiftState); override;
     procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X,Y: Integer); override;
     procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
@@ -1924,6 +1926,8 @@
     Options := Options - [goVertLine];
 end;
 
+{$IF lcl_fullversion < 1090000}
+// Workaround for Lazarus issue 31942.
 function TDrawGridEx.SelectCell(aCol, aRow: Integer): Boolean;
 begin
   Result:= inherited SelectCell(aCol, aRow);
@@ -1934,6 +1938,7 @@
     SetColRow(aCol, aRow);
   end;
 end;
+{$ENDIF}
 
 function TDrawGridEx.GetVisibleRows: TRange;
 var
Index: src/fileviews/ufileviewwithgrid.pas
===================================================================
--- src/fileviews/ufileviewwithgrid.pas	(revision 7616)
+++ src/fileviews/ufileviewwithgrid.pas	(working copy)
@@ -19,6 +19,9 @@
   protected
     FFileView: TFileViewWithGrid;
   protected
+    {$IF lcl_fullversion < 1090000}
+    function SelectCell(aCol, aRow: Integer): Boolean; override;
+    {$ENDIF}
     procedure RowHeightsChanged; override;
     procedure ColWidthsChanged;  override;
     procedure FinalizeWnd; override;
@@ -183,6 +186,20 @@
   inherited KeyDown(Key, Shift);
 end;
 
+{$IF lcl_fullversion < 1090000}
+// Workaround for Lazarus issue 31942.
+function TFileViewGrid.SelectCell(aCol, aRow: Integer): Boolean;
+begin
+  Result:= inherited SelectCell(aCol, aRow);
+  // ScrollToCell hangs when Width = 0
+  if Width = 0 then
+  begin
+    Result:= False;
+    SetColRow(aCol, aRow);
+  end;
+end;
+{$ENDIF}
+
 procedure TFileViewGrid.RowHeightsChanged;
 begin
   inherited RowHeightsChanged;
bug1857.patch (2,112 bytes)   
bug1857-lclversion.patch (1,545 bytes)   
Index: src/fileviews/ucolumnsfileview.pas
===================================================================
--- src/fileviews/ucolumnsfileview.pas	(revision 7902)
+++ src/fileviews/ucolumnsfileview.pas	(working copy)
@@ -40,7 +40,7 @@
     procedure SetGridVertLine(const AValue: Boolean);
 
   protected
-    {$IF lcl_fullversion < 1090000}
+    {$IF lcl_fullversion < 1080003}
     function SelectCell(aCol, aRow: Integer): Boolean; override;
     {$ENDIF}
     procedure KeyDown(var Key: Word; Shift: TShiftState); override;
@@ -1986,7 +1986,7 @@
     Options := Options - [goVertLine];
 end;
 
-{$IF lcl_fullversion < 1090000}
+{$IF lcl_fullversion < 1080003}
 // Workaround for Lazarus issue 31942.
 function TDrawGridEx.SelectCell(aCol, aRow: Integer): Boolean;
 begin
Index: src/fileviews/ufileviewwithgrid.pas
===================================================================
--- src/fileviews/ufileviewwithgrid.pas	(revision 7902)
+++ src/fileviews/ufileviewwithgrid.pas	(working copy)
@@ -19,7 +19,7 @@
   protected
     FFileView: TFileViewWithGrid;
   protected
-    {$IF lcl_fullversion < 1090000}
+    {$IF lcl_fullversion < 1080003}
     function SelectCell(aCol, aRow: Integer): Boolean; override;
     {$ENDIF}
     procedure RowHeightsChanged; override;
@@ -186,7 +186,7 @@
   inherited KeyDown(Key, Shift);
 end;
 
-{$IF lcl_fullversion < 1090000}
+{$IF lcl_fullversion < 1080003}
 // Workaround for Lazarus issue 31942.
 function TFileViewGrid.SelectCell(aCol, aRow: Integer): Boolean;
 begin
bug1857-lclversion.patch (1,545 bytes)   
Fixed in Revision7621,7908,7915
Operating systemWindows
WidgetsetWin32
Architecture64-bit

Relationships

has duplicate 0001858 closed Infinite loop caused by TCustomGrid 

Activities

Alexx2000

2017-05-31 23:45

administrator   ~0002266

What Lazarus version do you use?

nicker

2017-06-01 00:31

reporter   ~0002267

I'm using 1.6.4
Also happens in 1.6.2.

cordylus

2017-06-01 09:16

developer   ~0002268

I've encountered this too, it happened to me during autoresize when quitting the horizontal mode and the bottom panel was in the brief view mode in a specific folder and the cursor was not on the first column.

Reported to the Lazarus tracker https://bugs.freepascal.org/view.php?id=31942

nicker

2017-06-01 12:39

reporter   ~0002270

It's obviously an LCL issue.
If feasible I would suggest in the meantime to create a bypass to resolve this issue.
We've encountered these infinite loop unresolved bug type before with the LCL.

also look at https://bugs.freepascal.org/view.php?id=28483

cordylus

2017-06-08 21:17

developer   ~0002283

The bug has been fixed in Lazarus.

I've found a workaround for this bug in the columns view code and copied it to the brief/thumbnails view. It works, but has a drawback: the cursor may change its position at the time it would have hang otherwise. I added conditional compilation directives so it will be used only with buggy Lazarus versions.

The patch is attached. I can't reproduce your case in 0.8.0 (in my case it helps), so please test. If it doesn't help, you might want to try to replace "Width = 0" with "(Width = 0) or (Height = 0)" since the log message in the Lazarus commit says it can happen with the height too.

nicker

2017-06-14 00:51

reporter   ~0002284

Took latest rev 7622.
Usually it takes me less than 30 seconds on a single layout to reproduce this bug.
I couldn't reproduce it in 10 minutes using 3 different layouts.
So currently it seems resolved without the need to check for height.

cordylus

2017-07-05 12:57

developer   ~0002292

The fix was merged to Lazarus 1.8 RC3, so
{$IF lcl_fullversion < 1090000}
should be replaced with
{$IF lcl_fullversion < 1080003}
in four places.

nicker

2017-10-11 18:57

reporter   ~0002377

Bug still happens in 1.64, same loop but from different event.
It didn't happen in 1.8RC4, yet.

---------------
CALL STACK
---------------
#0 SCROLLTOCELL(0x78bfd30, 3, 2, false) at grids.pas:3339
0000001 MOVEEXTEND(0x78bfd30, false, 3, 2) at grids.pas:7175
#2 MOVENEXTSELECTABLE(0x78bfd30, false, -1, 0) at grids.pas:7276
#3 CHECKCOUNT(0x78bfd30, 4, 23, true) at grids.pas:4983
#4 INTERNALSETCOLCOUNT(0x78bfd30, 4) at grids.pas:2211
#5 SETCOLCOUNT(0x78bfd30, 4) at grids.pas:2876
#6 CALCULATECOLROWCOUNT(0x78bfd30) at fileviews\uthumbfileview.pas:356
#7 DOONRESIZE(0x78bfd30) at fileviews\ufileviewwithgrid.pas:170
#8 RESIZE(0x78bfd30) at include\control.inc:3501
0000009 CALLALLONRESIZE(0x13fdab0, 0x78bfd30) at include\control.inc:2885
0000010 CALLALLONRESIZE(0x13fdab0, 0x78bab30) at include\control.inc:2879
0000011 CALLALLONRESIZE(0x13fdab0, 0x7a7e070) at include\control.inc:2879
0000012 CALLALLONRESIZE(0x13fdab0, 0x788c670) at include\control.inc:2879
0000013 CALLALLONRESIZE(0x13fdab0, 0x787b010) at include\control.inc:2879
0000014 CALLALLONRESIZE(0x13fdab0, 0x7877b70) at include\control.inc:2879
0000015 CALLALLONRESIZE(0x13fdab0, 0x78755b0) at include\control.inc:2879
0000016 CALLALLONRESIZE(0x13fdab0, 0x7871ed0) at include\control.inc:2879
0000017 DOALLAUTOSIZE(0x7871ed0) at include\control.inc:2910
0000018 DOALLAUTOSIZE(0x7871ed0) at include\wincontrol.inc:3523
0000019 ENABLEAUTOSIZING(0x7871ed0) at include\control.inc:5463
0000020 fin$542(0x13fdc40) at :8044
0000021 WMMOVE(0x7871ed0, {MSG = 3, UNUSEDMSG = 0, MOVETYPE = 128, XPOS = -9, YPOS = -9, POS = {X = -9, Y = -9}, DUMMY = 4294442999, RESULT = 0}) at include\wincontrol.inc:6883
0000022 WMMOVE(0x7871ed0, {MSG = 3, UNUSEDMSG = 0, MOVETYPE = 128, XPOS = -9, YPOS = -9, POS = {X = -9, Y = -9}, DUMMY = 4294442999, RESULT = 0}) at include\customform.inc:728
0000023 SYSTEM$_$TOBJECT_$__$$_DISPATCH$formal at :0
0000024 ?? at :0
0000025 ?? at :0
0000026 USER32!GhostWindowFromHungWindow at :0
0000027 ?? at :0

cordylus

2017-12-09 20:03

developer   ~0002406

Lazarus 1.8 stable has been released as 1.8.0.6, so the previously suggested < 1080003 will be valid for it, I'm attaching the patch.

nicker, given the new stable version, I think it doesn't worth the bother to search for another workaround for 1.6. If you'll receive it with Lazarus 1.8, it'll mean that it isn't fixed completely and should be investigated and reported to the Lazarus again, but it has to be reproducible.

Issue History

Date Modified Username Field Change
2017-05-31 23:20 nicker New Issue
2017-05-31 23:43 Alexx2000 Relationship added has duplicate 0001858
2017-05-31 23:45 Alexx2000 Note Added: 0002266
2017-05-31 23:45 Alexx2000 Status new => feedback
2017-06-01 00:31 nicker Note Added: 0002267
2017-06-01 00:31 nicker Status feedback => new
2017-06-01 09:16 cordylus Note Added: 0002268
2017-06-01 12:39 nicker Note Added: 0002270
2017-06-04 00:16 Alexx2000 Status new => acknowledged
2017-06-08 21:16 cordylus File Added: bug1857.patch
2017-06-08 21:17 cordylus Note Added: 0002283
2017-06-12 11:00 Alexx2000 Fixed in Revision => 7621
2017-06-12 11:00 Alexx2000 Status acknowledged => feedback
2017-06-14 00:51 nicker Note Added: 0002284
2017-06-14 00:51 nicker Status feedback => new
2017-06-14 06:55 Alexx2000 Status new => resolved
2017-06-14 06:55 Alexx2000 Fixed in Version => 0.8.0
2017-06-14 06:55 Alexx2000 Resolution open => fixed
2017-06-14 06:55 Alexx2000 Assigned To => Alexx2000
2017-07-05 12:57 cordylus Note Added: 0002292
2017-10-11 18:57 nicker Note Added: 0002377
2017-12-09 20:03 cordylus Note Added: 0002406
2017-12-09 20:03 cordylus File Added: bug1857-lclversion.patch
2017-12-11 19:09 Alexx2000 Fixed in Revision 7621 => 7621,7908
2017-12-11 19:09 Alexx2000 Target Version => 0.8.1
2017-12-15 22:46 Alexx2000 Fixed in Revision 7621,7908 => 7621,7908,7915
2017-12-23 14:40 Alexx2000 Fixed in Version 0.8.0 => 0.8.1
2020-11-30 07:44 Alexx2000 Status resolved => closed