Author Topic: Multiple Instances  (Read 9711 times)

DragonSt0rm

  • Guest
Multiple Instances
« on: December 18, 2005, 06:34:58 pm »
Linux  C::B 1 RC2.

When I have an instance of CodeBlocks running and I try to start another one I get the error message:
"""
Another program instance is already running, aborting.
"""
Well, I think there is no reason to prevent the user to open different projects in different instances of the IDE.
As mater of fact, it is quite common to work into a project that use a library, and notice that something in the library need to be fixed.
Fix and recompile the library and test the result by debugging the main project.

While I fully agree to prevent opening of the same project in different instances, the requirement to close the project open the lib compile, close the lib reopen the project is just annoying and counterproductive. Is there a particular design reason why this is not allowed, or is just a issue that slipped away.

Anyhow,  congratulation for the good work guys. 

DragonSt0rm

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Multiple Instances
« Reply #1 on: December 18, 2005, 06:38:59 pm »
This is configurable. Go to Settings->Environment, third checkbox from the top.
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."

DragonSt0rm

  • Guest
Re: Multiple Instances
« Reply #2 on: December 19, 2005, 01:26:20 am »
This is configurable. Go to Settings->Environment, third checkbox from the top.

Thanks, I didn't noticed it. It is working.
As a suggestion, you can add this explanation on the message box, to prevent another user to ask this question
before he looks on the menu :-)

Another point, I see now that is possible to open the same project in multiple instances without a warning.
Personally, I can not thing about a reason I may want to do that. This may be a place where a sefeguard can be put in place.
As a quick suggestion (no much taught put into): you can lock the project file ( fcntl , F_SETLK, fl type   = F_WRLCK). If is OK, then you are the only one opening
that project. If no, you can warn user that another instance is editing the same project and the project file is to be used read only (no file added/deleted or settings change).

Another thing I noticed (you guys asked for betatesters so don't blame me, I reply  to your request  :-) is that when a dialog is opened (like for example find)
you have to click in the edit box to write the text there.  Usually users expect the focus to be already set so they just start typing.

Third one: I see in my Linux version 2 setting boxes:
Run DDE server (Windows only) and Check & set file association (Windows only). 
It will be nice to put a #ifdef WIN32 or similar to gray out Windows only options in Linux.
It will be better to gray them out rather than remove, to keep exactly the same interface in both versions.

Just this for now.
 :D

Offline thomas

  • Administrator
  • Lives here!
  • *****
  • Posts: 3979
Re: Multiple Instances
« Reply #3 on: December 19, 2005, 01:50:33 am »
As a suggestion, you can add this explanation on the message box, to prevent another user to ask this question
Actually a brilliant idea... I'll do that :)

Quote
Another point, I see now that is possible to open the same project in multiple instances without a warning.
Personally, I can not thing about a reason I may want to do that.
That is why you can configure Code::Blocks so it only launches one instance. If you start the DDE server too (same location like the other setting), then the running instance will be used to open sources which you double-click.

Quote
If no, you can warn user that another instance is editing the same project and the project file is to be used read only (no file added/deleted or settings change).
Difficult, very difficult (although it sounds really easy). We could use a named mutex under Windows, but this is not portable. Using gcc attributes, you can also share variables between different processes, but again, this is only implemented for Windows. Alternatively, we could share a memory page which contains a list of open projects -- this would have to be modified using atomic ops like CMPXCHG... not nice, alltogether. Unluckily we can't just open the project with exclusive rights either, because the opening of projects is done inside the xml library (ok... we *could* work around that), and (more importantly) because this would abort revision control updates while a project is open, which can be quite painful.

Quote
Third one: I see in my Linux version 2 setting boxes:
Run DDE server (Windows only) and Check & set file association (Windows only).
Right.
EDIT: This one is already implemented.
« Last Edit: December 19, 2005, 02:00:04 am by thomas »
"We should forget about small efficiencies, say about 97% of the time: Premature quotation is the root of public humiliation."