Bug #15517 2009-04-14 19:37
markos
Recursive fail
I've had a problem with the Code::Blocks IDE, and figured it happened in the Code Completion plugin. When I saved a specific header file, Code::Blocks IDE just had a segmentation fault, and the crash report dialog did not even showed up. Then, I downloaded the source code and verified that the crash happened in the Code Completion plugin. The class TokesTree has two methods RemoveToken, a RemoveToken(int) and a RemoveToken(Token *), in file codecompletion/parser/token.cpp. In line 601, in method RemoveToken(Token *), there is a call for RemoveToken(int), which in turn, calls RemoveToken(Token *). In this same line, 601, we verified that there were several calls for RemoveToken(int idx) with the same idx as argument, leading to an infinite recursion, leading to the seg fault. As a workaround, we added the first 3 lines in RemoveToken(int idx), to check if the same idx was used before: void TokensTree::RemoveToken(int idx) { static int lastidx = -1; if(lastidx == idx) return; lastidx = idx; if(idx<0 || (size_t)idx >= m_Tokens.size()) return; RemoveToken(m_Tokens[idx]); } It solved the seg fault, but I know this is not a solution to this problem at all. One thing that I have to say is that this bug happened in a project where there are two files with same name but in different directories, representing two classes in different namespaces. If I open only the file or if I open the file in a project where it appears only once, the bug does not happen. Another interesting thing is that I have other files, in the same project, with equal names, representing classes with the same name, but in different namespaces, and the bug does not happen. It only happen in that specific file. I don't know if it helps, but a .cbTemp file is created and is not deleted in the directory that has that specific file I mentioned before. Unfortunately, I cannot release my source code. I hope what I reported helps you developers to correct this bug. Thanks
- Category
- Plugin::CodeCompletion
- Group
- Status
- Closed
- Close date
- 2011-02-24 05:49
- Assigned to
- mortenmacfly
History
Can you strip down the files in question to a minimal sample which you can provide?
A.k.a. remove all methods / content until the error disappears?!
I have done what you said and uploaded a file codeblocks_bug.tar.bz2 in website http://www.lia.ufc.br/~markos/codeblocks_bug/ containing the files and a Code::Blocks project.
If you change anything in any of the provided header files, for example, just by adding a character and saving, the Code::Blocks crashes.
I'd appreciate if, once you download the file, you let me know so that I erase it from the webpage.
My Code::Blocks version is SVN 5489.
Thanks in advance.
Got the files and can reproduce. Thanks! Now give me (us) some time to analyse...
Hi again,
I just tested the files again and the bug did not happen.
My Code::Blocks version is the very same, SVN 5489, but it is not happening again.
Maybe a gtk or wxWidgets update corrected the bug somehow.
Thanks for everything.
Does this bug still persist?
No, it has never happened again. Thanks for everything.