Tested with TC 9.20 64-bit.
Let's assume we have two icon files in some folder:
- iconG.ico (containing just a green square)
- iconR.ico (containing just a red square)
Now do the following:
1) restart TC to be sure, that TC's icon cache is empty
2) rename iconG.ico to iconG_.ico - both icons are shown properly
3) rename iconR.ico to iconG.ico - both icons are shown properly
4) rename iconG_.ico to iconR.ico - both icons are shown properly
5) once again, rename iconG.ico to iconG_.ico - both icons are shown properly
6) once again, rename iconR.ico to iconG.ico - icon for iconG.ico is now shown improperly, as a red square - after pressing F3 on the icon file, we can see that the icon file contains in fact a green square
7) once again, rename iconG_.ico to iconR.ico - both icons are shown improperly now
It seems that renaming an icon should make the cached icon - for previous name - removed.
Regards
Cache for file icons works improperly
Moderators: white, Hacker, petermad, Stefan2
- ghisler(Author)
- Site Admin
- Posts: 48124
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
TC does not verify whether a file from which an icon was loaded has changed. This is done for speed reasons - checking this for every single icon displayed would be terribly slow, especially when a virus scanner is active in the background. How often do you reassign icons? Just close and re-open TC when you do this.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com
- ghisler(Author)
- Site Admin
- Posts: 48124
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Well, of course I don't think that TC should monitor file contents. However, we are talking here about changing file names.
I don't know how TC's icon cache is implemented, but I can see the following potential solutions:
1) When renaming any file in TC - for example icon1.ico to icon2.ico - TC should also rename the cache entry assigned for this file; it seems, that currently icon2.ico is added to cache, but cache entry for icon1.ico is NOT invalidated - and it is (improperly) reused when any file named icon1.ico appears in the same folder again.
2) When deleting any file in TC, TC should invalidate cache entry assigned for this file.
3) When panel contents are refreshed (for example because TC has been moved to foreground or Ctrl+R has been used) and some files disappeared, TC should invalidate cache entries assigned for these files.
4) Currently, every icon cache entry contains - at least - file name and its icon image. But file's last modification date could also be added to the cache entry: when entering into any folder, last modification date of each file is read by TC; this date could be just compared with date in the assigned cache entry - any difference means, that the file has been modified asynchronously (for example by using Explorer) - so this single cache entry should be invalidated.
Please note that these solutions should not cause any TC slow down - no whole cache invalidation, no all icons reloading.
What's more, removing invalidated cache entries can lead to memory savings!
Regards
I don't know how TC's icon cache is implemented, but I can see the following potential solutions:
1) When renaming any file in TC - for example icon1.ico to icon2.ico - TC should also rename the cache entry assigned for this file; it seems, that currently icon2.ico is added to cache, but cache entry for icon1.ico is NOT invalidated - and it is (improperly) reused when any file named icon1.ico appears in the same folder again.
2) When deleting any file in TC, TC should invalidate cache entry assigned for this file.
3) When panel contents are refreshed (for example because TC has been moved to foreground or Ctrl+R has been used) and some files disappeared, TC should invalidate cache entries assigned for these files.
4) Currently, every icon cache entry contains - at least - file name and its icon image. But file's last modification date could also be added to the cache entry: when entering into any folder, last modification date of each file is read by TC; this date could be just compared with date in the assigned cache entry - any difference means, that the file has been modified asynchronously (for example by using Explorer) - so this single cache entry should be invalidated.
Please note that these solutions should not cause any TC slow down - no whole cache invalidation, no all icons reloading.
What's more, removing invalidated cache entries can lead to memory savings!
Regards
- Tahattmeruh
- Senior Member
- Posts: 232
- Joined: 2003-05-16, 13:35 UTC
Re: Cache for file icons works improperly
Thanks. I have the same bug.
It the cache would cache filesize and filedate also, there should be no speed penalty and my problems would be solved.
It the cache would cache filesize and filedate also, there should be no speed penalty and my problems would be solved.