Just found a funny bug by accident.
Double-clicking a project file while an instance of Code::Blocks is still running a build (minimized, in my case) brings up Code::Blocks, opens the project, switches to its first target, and uses this target's paths and settings for the next target in the running build, resulting in sudden, unexpected death.
Similarly, hitting "clean" and then double clicking a non-active project in the workspace will delete all files in the first project, and then initiate the build for the other project. This can turn out quite funny, if Code::Blocks reports "nothing to do, everything is up to date" after it has just deleted all files.
Double-clicking a non-active project in the workspace while a build is running activates that project, but seems to work reliably in every way. Surprising... I was unable to break anything by doing so.
The problem obviously lies in the fact that opening a different project changes the state which the build depends on (although I'm surprised this doesn't break the build in the third case).
Of course this finding opens the question as to what is the correct behaviour for opening a project while a build is running:
1. postpone opening until the build is done, which could be 30 minutes, 2 hours, or anything (ugh...)
2. fail (um...?)
3. show a silly alert (argh...)
4. open the project and break the running build (lol?)
5. create another instance of the whole project state (yeah, right...)