Developer forums (C::B DEVELOPMENT STRICTLY!) > Development
Crash when clean a single file
MortenMacFly:
I'd like to propose a patch (see attached) for the clean and rebuild issue. This pretty much is what killerbot proposed, too (allthough I read his post just now, but we had the same idea, obviously). Anyway: There are a lot more glitches -> just search for "->Init(" in compilergcc.cpp. A lot of these initialisations could fail because CompilerFactory::GetCompiler(m_CompilerId) returns 0. I guess it's really worth a comment by mandrav. There should be a better solution as the patch -> maybe really what I've sated in my previous post never let CompilerFactory::GetCompiler(m_CompilerId) return 0 but the default compiler instead. How about that?
With regards, Morten.
Edit: This just came into my mind: CompilerFactory::GetDefaultCompilerID() and CompilerFactory::GetDefaultCompiler() could both return and empty string, too!!! This should be taken into account, so the "return default compiler instead" proposal may not be a good solution eigther...?!
[attachment deleted by admin]
lfm:
but if i open a project at 1st, then close this project. Now, open a single file, all is fine in this time .
Game_Ender:
MortenMacFly, maybe you should clean that patch up. It is generally not a good idea to put the if and the statement it controls on the same line, it makes the code harder to read. You should also lump the return -1 in with the same if() and not use 2. Unless there is some reason for this?
MortenMacFly:
--- Quote from: Game_Ender on May 25, 2006, 03:19:13 am ---It is generally not a good idea to put the if and the statement it controls on the same line, it makes the code harder to read.
--- End quote ---
I generally agree. But in this very case I want to make clear that I'm using another call to CompilerFactory. This can visually be easy compared because it stands in the same alignment as within the line above.
In addition: A one-liner if statement can be written in one line. This is proposed by quite some standards (coding guidelines). So altogether this is kind of philosophic.
--- Quote from: Game_Ender on May 25, 2006, 03:19:13 am ---You should also lump the return -1 in with the same if() and not use 2. Unless there is some reason for this?
--- End quote ---
Yes, there is a reason, of course -> the second if statement might not be issued if the first one already returns a valid compiler. But if this is not the case the second if statement is triggered. How would you do that? In the end if both fail we have to return without success. I guess don't understand.
BTW: What you did not see: I was missing the semicolon behind both first if-statements (in Clean and Rebuild).
With regards, Morten.
MortenMacFly:
--- Quote from: lfm on May 25, 2006, 01:54:29 am ---but if i open a project at 1st, then close this project. Now, open a single file, all is fine in this time .
--- End quote ---
I am aware of that. The reason is that m_CompilerId is a member variable that is properly set once you have opened a project. It is initialised by then so if you open a single file after a project the call to CompilerFactory::GetCompiler(m_CompilerId) will succeed.
With regards, Morten.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version