This forum uses cookies. Click X button to hide this message. What is stored? / Privacy
Total Commander Forum Index Total Commander
Forum - Public Discussion and Support
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Toolbar button configuration dialog leaks file handle

 
Post new topic   Reply to topic    Total Commander Forum Index -> TC Fixed bugs Printable version
View previous topic :: View next topic  
Author Message
elgonzo
Senior Member
Senior Member


Joined: 04 Sep 2013
Posts: 377

PostPosted: Fri Feb 02, 2018 12:21 pm    Post subject: Toolbar button configuration dialog leaks file handle Reply with quote

Affected: TC32 and TC64 (9.12, older versions not tested)
OS: MS Windows 7 Pro x64, english

The toolbar button configuration dialog leaks a file handle of the file that is used as the source of the icon. This effectively locks the icon file until TC is closed.

The bug happens if the file providing the icon is an .EXE, .DLL, or .ICL.
The problem does not happen when using .ICO files.

As far as i can tell, the (eventually leaked) file handle is created at the moment when the icon view of the button configuration dialog is showing/reading the icons from the chosen icon file (.EXE, .DLL, .ICL). When closing the dialog, this file handle is not closed, i.e., it is leaked.


Important to know for anyone trying to reproduce the problem: The leaked file handle (which seems to be a file mapping/memory-mapped I/O handle) will not prevent another process from renaming the file or moving it to another directory on the same(!) drive/volume. However, it does not permit deleting or overwriting the file (deletion would also include trying to move the file to another drive/volume). This means, renaming or moving the file on the same drive does not help in determining whether there is an open/leaked handle for this file. Keep this in mind when trying to reproduce the problem.


How to reproduce:

1. Put a copy of a .EXE, .DLL, or .ICL file with icons in a test folder.

2. Start TC (with a clean/fresh INI to avoid any unwanted interactions with plug-ins and such...)

3. Open the toolbar button configuration dialog.

4. In the dialog, set the exe/dll/icl file in the test folder as "icon file". Make sure the icon view shows the icons contained in this exe/dll/icl file.

5. Keep the toolbar button configuration dialog open.

6. In another TC instance (or Windows file explorer), try overwriting the exe/dll/icl file in the test folder (with its original version, for example).
Result: The file cannot be overwritten.

7. Close the toolbar button configuration dialog (either with OK or Cancel), and retry step #6.
Result: The file can still not be overwritten.

8. Close the offending TC instance (the one in which you opened the toolbar button configuration dialog). Try step #6 once more.
Result: This time the file can be overwritten again.


Side notes:

When selecting and viewing different exe/dll/icl icon files in the same dialog instance, the file handle of the previous icon file will be closed properly, as it seems. This suggests a possible bug fix could perhaps be as easy as "de-initializing"/resetting the icon view control explicitly in the dialog close/closing event handler or something similar...
_________________
Windows 7 Pro x64 SP1
Back to top
View user's profile Send private message
ts4242
Power Member
Power Member


Joined: 02 Feb 2004
Posts: 1909
Location: Egypt

PostPosted: Fri Feb 02, 2018 1:42 pm    Post subject: Reply with quote

Confirmed in TC 9.12 x32 and x64 under Windows 10 (1709 build 16299.192)

Not Confirmed in TC 9.0a x32 and x64 under Windows 10 (1709 build 16299.192)
_________________
Author of Ultra TC Editors
Back to top
View user's profile Send private message Send e-mail Visit poster's website
elgonzo
Senior Member
Senior Member


Joined: 04 Sep 2013
Posts: 377

PostPosted: Fri Feb 02, 2018 1:44 pm    Post subject: Reply with quote

ts4242 wrote:
Confirmed in TC 9.12 x32 and x64 under Windows 10 (1709 build 16299.192)

Not Confirmed in TC 9.0a x32 and x64 under Windows 10 (1709 build 16299.192)

Damn, you are quick Smile
Was going to cross check with TC8.52a on the weekend to see whether this is an "old" bug, but it seems you took that task away from me. Thanks Smile
_________________
Windows 7 Pro x64 SP1
Back to top
View user's profile Send private message
ts4242
Power Member
Power Member


Joined: 02 Feb 2004
Posts: 1909
Location: Egypt

PostPosted: Fri Feb 02, 2018 3:13 pm    Post subject: Reply with quote

I have tested in reverse order 9.12, 9.10 and 9.0a, I stopped once I found a clean version.
_________________
Author of Ultra TC Editors
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ts4242
Power Member
Power Member


Joined: 02 Feb 2004
Posts: 1909
Location: Egypt

PostPosted: Thu May 03, 2018 3:52 pm    Post subject: Reply with quote

Fixed in TC 9.20 ▀1 x32 & x64
_________________
Author of Ultra TC Editors
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Total Commander Forum Index -> TC Fixed bugs All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Imprint/Impressum: This site is maintained by Ghisler Software GmbH
Privacy Policy | Datenschutzerklńrung | Politique de ConfidentialitÚ

Using phpBB © phpBB Group