Menu

#1083 Fix multiple instances when "Use an already running instance" is checked"

Next_Release
open
nobody
UI (54)
Patch
2022-09-23
2021-03-20
No

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.

1 Attachments

Related

Tickets: #1280

Discussion

  • Teodor Petrov

    Teodor Petrov - 2021-03-20

    Is this windows only change?

     
  • Miguel Gimenez

    Miguel Gimenez - 2021-03-20

    No

     
  • Teodor Petrov

    Teodor Petrov - 2021-03-20

    Have you tested it on linux?

     
  • Teodor Petrov

    Teodor Petrov - 2021-03-20

    There is also the --multiple-instances flag, which probably does the same thing.

     
  • Miguel Gimenez

    Miguel Gimenez - 2021-03-20

    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.

     
  • Teodor Petrov

    Teodor Petrov - 2021-03-20

    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.

     
  • Teodor Petrov

    Teodor Petrov - 2021-03-20

    For the files specified without the --file option you could use m_DelayedFilesToOpen.empty() style of check.

     
  • Miguel Gimenez

    Miguel Gimenez - 2021-03-21

    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) to Open associated files in an already running instance (if possible)

     
  • Miguel Gimenez

    Miguel Gimenez - 2021-03-22

    This line

    if (!cmdLine.IsEmpty())
    

    can be removed because argc > 1.

     
  • Teodor Petrov

    Teodor Petrov - 2021-03-22
    • summary: FIx multiple instances when "Use an already running instance" is checked" --> Fix multiple instances when "Use an already running instance" is checked"
     
  • Teodor Petrov

    Teodor Petrov - 2021-03-22

    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.

     
  • Andrew Cottrell

    Andrew Cottrell - 2021-07-08

    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.

     
  • Miguel Gimenez

    Miguel Gimenez - 2021-12-31
    • assigned_to: Miguel Gimenez
     
  • Miguel Gimenez

    Miguel Gimenez - 2022-05-06
    • assigned_to: Miguel Gimenez --> nobody
     
  • Miguel Gimenez

    Miguel Gimenez - 2022-09-23
    • Milestone: Next_Nightly --> Next_Release
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.