Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: Aaron on August 05, 2016, 02:59:41 pm

Title: [SOLVED]Multiple instances, ver 16.0.1. Is this feature operative?
Post by: Aaron on August 05, 2016, 02:59:41 pm
I have un-checked the 'Allow only one running instance (will take place after restart) feature.

Restarted Code::Blocks, but only one instance will open. 
The open CB window flickers, but no 2nd CB opens.

Any advice appreciated.
Title: Re: Multiple instances, ver 16.0.1. Is this feature operative?
Post by: MortenMacFly on August 05, 2016, 03:24:57 pm
Works for me.
Title: Re: Multiple instances, ver 16.0.1. Is this feature operative?
Post by: Aaron on August 05, 2016, 10:14:17 pm
Thanks Morten

Should I report this as a bug or is there anything else I could try?
Registry?

Running Win 7 Pro, SP 1.
Title: Re: Multiple instances, ver 16.0.1. Is this feature operative?
Post by: BlueHazzard on August 05, 2016, 11:44:16 pm
works for me to.. win 7 sp1

can you restart your pc and try again?
Title: Re: Multiple instances, ver 16.0.1. Is this feature operative?
Post by: Aaron on August 06, 2016, 12:10:14 am
I just restarted it the second time, same results.
Title: Re: Multiple instances, ver 16.0.1. Is this feature operative?
Post by: oBFusCATed on August 06, 2016, 03:34:36 am
Have you tried to disable the "use already running instance if possible"?
Title: Re: Multiple instances, ver 16.0.1. Is this feature operative?
Post by: Aaron on August 06, 2016, 06:14:07 am
Quote
Have you tried to disable the "use already running instance if possible"?

YES, and it worked Great!!

Thank you.
Title: Re: [SOLVED]Multiple instances, ver 16.0.1. Is this feature operative?
Post by: tilmannreh on October 27, 2016, 08:33:28 am
Hello,

unfortunately, there is still a bug in CB: Only if you start it without an argument (i.e. by clicking on the exe or starting it from the start menu), it will open a second instance.

If one instance of CB is already running, clicking on another .cbp file reproducibly opens the second project in the first instance - regardless of the checkboxes - and completely messes everything up. (BTW, it was a *very* bad idea to put the files of all open projects in a single tab row.)

This is a very boring bug that should be fixed soon.
(Generally, it's far more convenient to start programs indirectly by their files, than having to search through the "open file" dialogs if you start the program first... It's really interesting that CB makes a difference here and simply ignores the settings when started with the project file as argument.)

Tilmann
Title: Re: [SOLVED]Multiple instances, ver 16.0.1. Is this feature operative?
Post by: BlueHazzard on October 27, 2016, 10:48:52 am
What operating system are you using?

YEAAA  1000 posts
Title: Re: [SOLVED]Multiple instances, ver 16.0.1. Is this feature operative?
Post by: tilmannreh on October 27, 2016, 04:17:14 pm
Windows 7 SP1 Pro - sorry, forgot to mention.
(I might do tests on a W8.1 machine to confirm, but I assume this does not depend on the Windows version.)

Tilmann
Title: Re: [SOLVED]Multiple instances, ver 16.0.1. Is this feature operative?
Post by: BlueHazzard on October 27, 2016, 06:50:13 pm
i can't reproduce this on win7 with latest trunk

can you give me a step by step guide?

and completely messes everything up.
what does this mean? Can you give a detailed description, or a screenshot (as noted above i can't reproduce this)

(BTW, it was a *very* bad idea to put the files of all open projects in a single tab row.)
Your opinion, i hate it if there are multiple tab rows ;) ... I use the Open file list view, it is  the most clear view than any other form of control...
Title: Re: [SOLVED]Multiple instances, ver 16.0.1. Is this feature operative?
Post by: tilmannreh on October 27, 2016, 10:03:32 pm
Hello, first of all thanks for your help!

It's interesting that you can't reproduce this - it's perfectly reproducible for me (and I also just confirmed that with the W8.1 machine).

Step by step guide:
- Take care both of these checkboxes are unchecked. Close CB.
- Open the first project by double-clicking the .cbp project file from whatever shell (I use Total Commander).
   The project and all its open files show up in CB.
   (BTW, it doesn't make a difference if you open the first instance directly or indirectly.)
- Open the second project by double-clicking its .cbp project file.
   The second project and all its open files come up in the same instance of CB.
   It should however open a second instance of CB.

With "messing it up" I mean: when the second project is opened in the same instance, all of its open files are also opened. However, in the tab row there is no way to distinguish between the files of either project. Say, I am working on two independent projects simultaneously (since they communicate with each other, for example), and both of them have files of the same name (say, main.h, main.c, pindef.h etc. pp.). Now all these equally named, but completely different files of two projects (that reside in completely different paths as well) appear side by side in the tabs as if they'd belong to one single project. That truly is a mess.

I don't speak for multiple tab rows. I wanted to emphasize "all files of all projects". If more than one project is opened in a single CB instance, it should always show only the files belonging to the currently selected project. Never all files of all projects, several of them equally named.

Tilmann
Title: Re: [SOLVED]Multiple instances, ver 16.0.1. Is this feature operative?
Post by: BlueHazzard on October 27, 2016, 11:31:03 pm
Now we are getting somewhere. Funnily i have unchecked this option all the time, and funnily i never noticed  that it opens the project in the same instance... Here you can say i never saw the wood because of the trees :D

i will try to look into it...

I don't speak for multiple tab rows. I wanted to emphasize "all files of all projects". If more than one project is opened in a single CB instance, it should always show only the files belonging to the currently selected project. Never all files of all projects, several of them equally named.
This would be a interesting feature... Can you post it on SF so it wont get lost?
Title: Re: [SOLVED]Multiple instances, ver 16.0.1. Is this feature operative?
Post by: jens on October 27, 2016, 11:53:10 pm
Now we are getting somewhere. Funnily i have unchecked this option all the time, and funnily i never noticed  that it opens the project in the same instance... Here you can say i never saw the wood because of the trees :D

i will try to look into it...

I just tested it here on Fedora with the actual trunk and it works as expected (two instances of C::B).

I don't speak for multiple tab rows. I wanted to emphasize "all files of all projects". If more than one project is opened in a single CB instance, it should always show only the files belonging to the currently selected project. Never all files of all projects, several of them equally named.
This would be a interesting feature... Can you post it on SF so it wont get lost?

I like to have files from different projects in one workspace open side by side.
Such an option should be configurable and off as default, so the current behaviour does not change.
Title: Re: [SOLVED]Multiple instances, ver 16.0.1. Is this feature operative?
Post by: BlueHazzard on October 28, 2016, 12:19:06 am
The only culprit line i can think of is this:
src\app.cpp:629
Code
if (m_DDE && !m_Batch && Manager::Get()->GetConfigManager(_T("app"))->ReadBool(_T("/environment/use_ipc"), true))
but why should this fail in msw?

has someone an idea how to debug this?
Title: Re: [SOLVED]Multiple instances, ver 16.0.1. Is this feature operative?
Post by: oBFusCATed on October 28, 2016, 12:48:52 am
I don't speak for multiple tab rows. I wanted to emphasize "all files of all projects". If more than one project is opened in a single CB instance, it should always show only the files belonging to the currently selected project. Never all files of all projects, several of them equally named.
This would be a interesting feature... Can you post it on SF so it wont get lost?

I like to have files from different projects in one workspace open side by side.
Such an option should be configurable and off as default, so the current behaviour does not change.

I don't see this as good idea. Nor I see how this is useful? If you have two projects in the workspace you'll for sure want to edit files from both projects at the same time. This is how I do it all the time. If I want to find which is the project or where the files is on the hard disk I'm using the tooltip in the notebook.

p.s. for single row tabs it is a limitation in our tab/notebook control we're using, so even if we wanted to add it, we can't without massive modifications to this control.
p.p.s. probably we could try assigning different colors to different projects and use those for the tabs, but this will require some non-portable tab drawing, which I'm not sure we want to do. Probably we could draw some icons...
p.p.p.s another options is to print the name of the project before the filename. Something like project1:main.cpp.
Title: Re: [SOLVED]Multiple instances, ver 16.0.1. Is this feature operative?
Post by: tilmannreh on October 28, 2016, 08:15:19 am
I don't speak for multiple tab rows. I wanted to emphasize "all files of all projects". If more than one project is opened in a single CB instance, it should always show only the files belonging to the currently selected project. Never all files of all projects, several of them equally named.
This would be a interesting feature... Can you post it on SF so it wont get lost?
I like to have files from different projects in one workspace open side by side.
Such an option should be configurable and off as default, so the current behaviour does not change.

OK, making this configurable surely is a good idea.
Do we still need to post this suggestion elsewhere, or did you already note it on some improvement suggestion list?

Thanks, Tilmann
Title: Re: [SOLVED]Multiple instances, ver 16.0.1. Is this feature operative?
Post by: oBFusCATed on October 28, 2016, 09:11:34 am
Do we still need to post this suggestion elsewhere, or did you already note it on some improvement suggestion list?

It is only in the forum at the moment of time. To make it a feature request you need to post it on the tracker on the sf.net page. But then you'll have to find someone willing to implement it.
Title: Re: [SOLVED]Multiple instances, ver 16.0.1. Is this feature operative?
Post by: tilmannreh on October 29, 2016, 10:22:47 am
It's not too important for me right now.

I would rather see the bug fixed so that clicking on two project files allows me to open two instances...
Then, at least for me, there's no need to change handling of multiple projects in the same workspace since I don't use it.
Title: Re: [SOLVED]Multiple instances, ver 16.0.1. Is this feature operative?
Post by: BlueHazzard on October 30, 2016, 01:35:53 pm
i tried to debug this, but was not successful on windows...

Something else:
Code
#ifdef __WXMSW__
            m_DDE = !parser.Found(_T("no-dde"));
            m_Assocs = !parser.Found(_T("no-check-associations"));
#else
            m_DDE = !parser.Found(_T("no-ipc"));
#endif
isn't this confusing? On windows the command line parameter is "no-dde" and on unix "no-ipc"... Shouldn't this be interchangeable?
Title: Re: [SOLVED]Multiple instances, ver 16.0.1. Is this feature operative?
Post by: BlueHazzard on October 30, 2016, 03:00:59 pm
Ok after more testing i came to the following result:
1) After some code analysis i could not find any bug
2) I tried different approaches to debug this and i was not successful to reproduce the bug
3) After checking what .exe files are started by double clicking from the explorer i noticed that it started some old codeblocks version
4) I deleted all registry items that where related with opening codeblocks from the explorer and now all is working as expected. All the settings work as intended

TL;DR: Codeblocks works fine, no bugs related to DDE. Windows was messing up (but i don't know how and why)
Title: Re: [SOLVED]Multiple instances, ver 16.0.1. Is this feature operative?
Post by: stahta01 on October 30, 2016, 05:44:09 pm
Ok after more testing i came to the following result:
1) After some code analysis i could not find any bug
2) I tried different approaches to debug this and i was not successful to reproduce the bug
3) After checking what .exe files are started by double clicking from the explorer i noticed that it started some old codeblocks version
4) I deleted all registry items that where related with opening codeblocks from the explorer and now all is working as expected. All the settings work as intended

TL;DR: Codeblocks works fine, no bugs related to DDE. Windows was messing up (but i don't know how and why)

Problem is likely in the CB Installer from what you described.
IIRC, both 8.02 and 10.?? installers did more registry stuff in Windows; likely if you had either installed you would have gotten weird issues like this.

I will try installing the current stable release and a nightly to see if the problem happens.
Then, if it fails to happen will install multiple CB stable releases and see if I see it.

Be a few days/weeks before I start; still working on a CB coding change in CompilerFactory.

Tim S.
 
Title: Re: [SOLVED]Multiple instances, ver 16.0.1. Is this feature operative?
Post by: tilmannreh on October 30, 2016, 07:24:36 pm
Problem is likely in the CB Installer from what you described.
IIRC, both 8.02 and 10.?? installers did more registry stuff in Windows; likely if you had either installed you would have gotten weird issues like this.

This is interesting. Indeed, I was using 8.02 and 10.05 before.
I will test with a fresh install of the current version and then report if the problem is reproducible.
Title: Re: [SOLVED]Multiple instances, ver 16.0.1. Is this feature operative?
Post by: tilmannreh on November 11, 2016, 12:32:50 pm
Hello again, and sorry for the delay. Other really urgent work got in the way...

Meanwhile, I did a fresh install (CB 16.0.1) on another W7Pro computer. The bug is reproducible there as well, CB never opens a second instance when another project is opened by double-click on the .cbp file.

However, at a W8.1 laptop I uninstalled CB, then cleaned the registry from all CB related entries, and did a fresh new install of CB 16.0.1 as well. Interestingly, here a second instance is opened if I do exactly the above.

This is really weird.  :-\
Title: Re: [SOLVED]Multiple instances, ver 16.0.1. Is this feature operative?
Post by: tilmannreh on November 14, 2016, 10:26:07 pm
Hello once more...

I found out that somewhere in the W8.1 system there were residues from the previous CB installation(s). So I uninstalled it again, and then manually deleted *every* entry in the registry and *all* folders and files below C:\Users that contained anything about CB.

After having done a fresh installation of CB 16.0.1 on that W8.1 laptop again, it behaves exactly like the fresh installation on the W7Pro computer before (with the bug being persistant).

So in fact there is no difference between these two Windows versions, and the bug appears perfectly reproducible to me. Opening a second project by just double-clicking the .cbp file in a shell like Total Commander does *not* open a second instance of CB even though this should happen according to the settings.

On the other hand, the W8.1 laptop with the "uncomplete" deinstallation before CB installation didn't show that buggy behaviour - so it appears to be somehow related to data in the registry and/or the "Users" files in Windows indeed. This also explains why this bug obviously doesn't show in Linux.

If there's anything I could test for further analysis, let me know.
Title: Re: [SOLVED]Multiple instances, ver 16.0.1. Is this feature operative?
Post by: stahta01 on November 15, 2016, 01:43:28 am
My guess it is related to the ddeexec and the entries under it in HKEY_CURRENT_USER\Software\Classes\CodeBlocks.cbp.

Code
HKEY_CURRENT_USER\Software\Classes\CodeBlocks.cbp\shell\open\ddeexec

When, I deleted the ddeexec; then the CB open a second instance when I opened a cbp file.

But, my computer is Windows 10 32 bit and I have a weird CB setup history.

Likely the fix is editing associations.cpp file; but, it should be some who knows DDE.

Tim S.

Title: Re: [SOLVED]Multiple instances, ver 16.0.1. Is this feature operative?
Post by: Miguel Gimenez on July 08, 2021, 05:29:15 pm
UPDATE: this is fixed in r12309 (https://sourceforge.net/p/codeblocks/code/12309/) (2021-03-19)
Title: Re: [SOLVED]Multiple instances, ver 16.0.1. Is this feature operative?
Post by: stahta01 on July 08, 2021, 05:44:32 pm
Wow, my guess was completely right in this case and I have no memory of ever making the guess.

Tim S.