Bug #12261 2007-10-23 17:11

kazade

Random crash while editing

I keep getting random crashes in code blocks, it tends to happen about 60% of the time when I press CTRL+S to save a source file. It also only happens when a project gets particularly big.

I ran codeblocks through gdb and got the following traceback:

#0 0xb6f4f2eb in wxGenericTreeItem::GetChildrenCount ()

from /usr/lib/libwx_gtk2u_core-2.8.so.0

#1 0xb6f4f370 in wxGenericTreeCtrl::GetChildrenCount ()

from /usr/lib/libwx_gtk2u_core-2.8.so.0

#2 0xb2dc677b in ClassBrowserBuilderThread::RemoveInvalidNodes (

this=0x8cad250, tree=0x8ca7e00, parent={m_pItem = 0x9d74dc8})

at classbrowserbuilderthread.cpp:258

#3 0xb2dc6869 in ClassBrowserBuilderThread::RemoveInvalidNodes (

this=0x8cad250, tree=0x8ca7e00, parent={m_pItem = 0x8e66720})

at classbrowserbuilderthread.cpp:291

#4 0xb2dc6869 in ClassBrowserBuilderThread::RemoveInvalidNodes (

this=0x8cad250, tree=0x8ca7e00, parent={m_pItem = 0x8e8b310})

at classbrowserbuilderthread.cpp:291

#5 0xb2dc8f66 in ClassBrowserBuilderThread::BuildTree (this=0x8cad250)

at classbrowserbuilderthread.cpp:214

#6 0xb2dc9145 in ClassBrowserBuilderThread::Entry (this=0x8cad250)

at classbrowserbuilderthread.cpp:131

#7 0xb6be68d8 in wxThreadInternal::PthreadStart ()

from /usr/lib/libwx_baseu-2.8.so.0

#8 0xb6be694d in wxPthreadStart () from /usr/lib/libwx_baseu-2.8.so.0

#9 0xb6ae146b in start_thread () from /lib/tls/i686/cmov/libpthread.so.0

#10 0xb693d73e in clone () from /lib/tls/i686/cmov/libc.so.6

The above code is found in the code completion plugin, codeblocks does attempt to display a "Debug report" window but it is just frozen and I have to kill the program.

Category
Application::Crash
Group
 
Status
Open
Close date
 
Assigned to
 
kazade 2007-10-23 17:14

Sorry I should have said. This is with wx 2.8.4 on Ubuntu Gutsy however I experienced the same problem before on Feisty.

kazade 2007-10-23 17:29

One other thing... the line of code this occurs on is:

bool hasChildren = (tree->GetChildrenCount(existing) > 0);

Now, I may be wrong, but here you only need to know if there are ANY children in which case GetChildrenCount does not need to recurse, so perhaps this:

bool hasChildren = (tree->GetChildrenCount(existing, false) > 0);

would be better?

Which will probably fix the bug I'm experiencing and would be a little quicker too :)

kazade 2007-10-24 07:28

Sorry to keep posting on this but I think I've come up with a better line of code:

bool hasChildren = tree->ItemHasChildren(existing);

for line 258 of classbrowserbuilderthread.cpp. I can't test this because I can't get CodeBlocks to compile on my machine (yet).

mandrav 2007-10-31 09:27

Rev. 4583 contains the change you requested.

Please test if this fixes your issue (which I doubt) and report back.

kazade 2007-11-18 09:39

You were right, it didn't fix the problem. Here is the new backtrace:

Program received signal SIGSEGV, Segmentation fault.

[Switching to Thread -1310827632 (LWP 6908)]

0xb6f170be in wxGenericTreeCtrl::ItemHasChildren ()

from /usr/lib/libwx_gtk2u_core-2.8.so.0

(gdb) bt

#0 0xb6f170be in wxGenericTreeCtrl::ItemHasChildren ()

from /usr/lib/libwx_gtk2u_core-2.8.so.0

#1 0xb2c9c373 in ClassBrowserBuilderThread::RemoveInvalidNodes (

this=0x8c69380, tree=0x8c54870, parent={m_pItem = 0x8db1fb0})

at classbrowserbuilderthread.cpp:258

#2 0xb2c9c466 in ClassBrowserBuilderThread::RemoveInvalidNodes (

this=0x8c69380, tree=0x8c54870, parent={m_pItem = 0x8dc2858})

at classbrowserbuilderthread.cpp:291

#3 0xb2c9eb86 in ClassBrowserBuilderThread::BuildTree (this=0x8c69380)

at classbrowserbuilderthread.cpp:214

#4 0xb2c9ed65 in ClassBrowserBuilderThread::Entry (this=0x8c69380)

at classbrowserbuilderthread.cpp:131

#5 0xb6bac5a8 in wxThreadInternal::PthreadStart ()

from /usr/lib/libwx_baseu-2.8.so.0

#6 0xb6bac61d in wxPthreadStart () from /usr/lib/libwx_baseu-2.8.so.0

#7 0xb6aa646b in start_thread () from /lib/tls/i686/cmov/libpthread.so.0

#8 0xb69026de in clone () from /lib/tls/i686/cmov/libc.so.6

kazade 2007-11-18 10:07

Also before that last backtrace the following is printed to the console:

//CTRL+S pressed here

Reparsing saved files...

Starting batch parsing

Parsing stage done (381 total parsed files, 11203 tokens in 0 minute(s), 0.1 seconds).

Updating class browser...

Class browser updated.

//Backtrace here