Is it just me, or this crash is related to Bug 11460?
http://developer.berlios.de/bugs/?func=detailbug&bug_id=11460&group_id=5358
ClassBrowserBuilderThread::RemoveInvalidNodes (
this=0x24e5ef8, tree=0x24e5038, parent={m_pItem = 0xffff0000})
at F:/cbsource/src/plugins/codecompletion/classbrowserbuilderthread.cpp:249
parent = {m_pItem = 0xffff0000}
isLastChild = true
data = (CBTreeData *) 0x704c710
existing = {m_pItem = 0x28f978}
#7 0x65e9e487 in ClassBrowserBuilderThread::BuildTree
Interestingly, both bugs are related to the symbol browser being rewritten.
Anyway... Is anybody *ACTUALLY WORKING* on debugging this?
Because I don't see anyone assigned to that bug.
Because I think i have a solution for this bug, and is to *clear the whole tree* instead of just removing the invalid nodes. However, I haven't examined that particular part of the codecompletion plugin. If nobody's working on it, I volunteer.
Yiannis: I won't commit, but I'm still going to do the experiment on my own machine.
See, I think the culprit is this function...
void ClassBrowserBuilderThread::RemoveInvalidNodes(wxTreeCtrl* tree, wxTreeItemId parent)
{
...
if (m_pTokens->at(data->m_TokenIndex) != data->m_pToken ||
data->m_TokenKind != data->m_pToken->m_TokenKind || // need to compare kinds: the token index might have been reused...
data->m_TokenName != data->m_pToken->m_Name || // same for the token name
!TokenMatchesFilter(data->m_pToken))
...
}
There's a string comparison for every item in there, and that's the cause of the lag.
Anyway, If I do any changes, I'll post them in the form of a patch.
Yiannis: Guess what.
IT WORKS!!!!!!!!!!! :D :D :D :D :D :D :D :D :D :D :D :D :D :D :D :D
I didn't commit anything, instead, I submitted the fix as patch #2084.
Anyway, my theory is that while the classbrowserbuilderthread is deleting nodes, it's also triggering tons of events. The DeleteChildren method of wxTreeCtrl does not trigger any event. Please try it and tell me if it works for you. I notice a side effect, which is that it rebuilds the tree everytime you change the setting above it. But at least it doesn't crash for me :)
Index: src/plugins/codecompletion/classbrowserbuilderthread.cpp
===================================================================
--- src/plugins/codecompletion/classbrowserbuilderthread.cpp (revision 4196)
+++ src/plugins/codecompletion/classbrowserbuilderthread.cpp (working copy)
@@ -185,8 +185,10 @@
m_pTreeTop->Freeze();
m_pTreeBottom->Freeze();
- RemoveInvalidNodes(m_pTreeTop, root);
- RemoveInvalidNodes(m_pTreeBottom, m_pTreeBottom->GetRootItem());
+ m_pTreeTop->DeleteChildren(m_pTreeTop->GetRootItem());
+ m_pTreeBottom->DeleteChildren(m_pTreeBottom->GetRootItem());
+ // RemoveInvalidNodes(m_pTreeTop, root);
+ // RemoveInvalidNodes(m_pTreeBottom, m_pTreeBottom->GetRootItem());
if (TestDestroy() || Manager::IsAppShuttingDown())
{