When you uncheck "Allow only one running instance" but check "Use an already running instance", double clicking on associated files works as expected (after commit 12309, of course).
The problem is that you can't open a second instance, neither double clicking on C::B icon or from inside C::B (when debugging C::B with C::B), because these attempts are redirected to the already running instance.
While this could be "expected behaviour", I see this strange and confusing, because it defeats the mutiple instance setting. My proposal is: if there is a filename in the command line, open it in the running instance as it is done now; if not, run a new instance.
Is this windows only change?
No
Have you tested it on linux?
There is also the --multiple-instances flag, which probably does the same thing.
Looks like filesInCmdLine in ParseCmdLine() only works with --file option, and there is no ready-to-use function to detect if a filename is present in the command line. Please close the ticket.
Isn't it easier if we just detect the case where there are no parameters?
There is the dbg-attach which also shouldn't start a new instance in most cases.
And plugins can have their own parameters. So we should mark certain parameters as a requirement for a new instance.
For the files specified without the
--file
option you could usem_DelayedFilesToOpen.empty()
style of check.I suppose (argc > 1) is enough for this.
I have also changed the wording of the setting from
Use an already running instance (if possible)
toOpen associated files in an already running instance (if possible)
This line
if (!cmdLine.IsEmpty())
can be removed because argc > 1.
I don't like this change.
The new message is also incorrect, because the dbg-attach flag would also try to reuse an old instance.
My 2c worth of info on this ticket is that I just fell into this hole and found the work around in the forum and then searched the tickets and found this ticket. I was trying to run two CB instances so I could run the nightly build on one monitor and my local build on another monitor to compare and check that they both work the same to ensure my changes are okay.
BTW the https://forums.codeblocks.org/index.php/topic,21350.15.html thread has a read count of 10512 times, so I think this may be affecting a number of people.