Recurring window serial number

Bug reports will be moved here when the described bug has been fixed

Moderators: Hacker, petermad, Stefan2, white

Post Reply
igor3v
Junior Member
Junior Member
Posts: 11
Joined: 2024-08-13, 14:52 UTC

Recurring window serial number

Post by *igor3v »

In a TC 11.03 64 bit , on Windows 10 x64, if I open multiple TC instances really fast, sometimes I get recurring window titles like

Code: Select all

Total Commander
[2] Total Commander
[3] Total Commander
[3] Total Commander
That is, there seem to be some sort of a race condition.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50390
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Recurring window serial number

Post by *ghisler(Author) »

Unfortunately this cannot be prevented: When you start a new instance, it looks for all the existing Total Commander windows before opening a new one. When you launch two instances at almost same time, then they will be looking for other instances before they have opened their windows, and will get the same result.
Author of Total Commander
https://www.ghisler.com
igor3v
Junior Member
Junior Member
Posts: 11
Joined: 2024-08-13, 14:52 UTC

Re: Recurring window serial number

Post by *igor3v »

Hmm... Doesn't it just require an appropriate IPC?
I've got no experience with the modern Free Pascal, but a quick google search suggests that this should be possible.
It looks like it is just necessary to protect the "critical section" (in between choosing a window name and actually creating/renaming the window) with a mutex or something.
  1. File-based mutex seem to be a quick-and-dirty way
  2. WinAPI Mutex
  3. something like an IPC-based-based semaphore.
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50390
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Recurring window serial number

Post by *ghisler(Author) »

This should be fixed in Total Commander 11.50 beta 1, please check it!
02.10.24 Fixed: When launching multiple instances of Total Commander at the same time (e.g. via batch file), make sure via Mutex that they don't get the same instance number in the title (32/64)
Author of Total Commander
https://www.ghisler.com
User avatar
funkymonk
Senior Member
Senior Member
Posts: 491
Joined: 2013-12-04, 09:56 UTC

Re: Recurring window serial number

Post by *funkymonk »

11.50b1 x32 dark

I have checked in some scenarios where this has happened in the past. Looks good now.
igor3v
Junior Member
Junior Member
Posts: 11
Joined: 2024-08-13, 14:52 UTC

Re: Recurring window serial number

Post by *igor3v »

I can confirm that the issue is no longer reproducible in TC 11.50b1.
Thanks for fixing!
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50390
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Recurring window serial number

Post by *ghisler(Author) »

Great, thanks!

Moderator message

Moved to fixed bugs
Author of Total Commander
https://www.ghisler.com
Post Reply