#22 kscope cores in src/symbolcompletion.cpp

open
nobody
None
5
2012-10-31
2007-10-30
Anonymous
No

I've been running into a problem over the past few months where KScope crashes about once a day. It seems to happen when I'm working in a new function or a file that's not in my current KScope project, but that is just a guess. I went ahead and did a build with the gcc debug flag on, so that I could get a real stack trace. I've attached the stack trace.

Apparently KScope fails to check for a NULL pointer. I've included a simple patch to address the problem. I don't know if this is how you really want to handle this type of error, but KScope hasn't crashed in 2 weeks now that I have this fix in place:

diff -r bfb018080589 src/symbolcompletion.cpp
--- a/src/symbolcompletion.cpp Thu Oct 25 10:13:58 2007 -0700
+++ b/src/symbolcompletion.cpp Mon Oct 29 17:35:07 2007 -0700
@@ -219,6 +220,10 @@ void SymbolCompletion::slotAddEntry(Fron

    // Get the line text
    pToken = pToken->getNext()->getNext()->getNext();
  • if( pToken == NULL )
  • {
  • return;
  • }
    sText = pToken->getData();

    // Find the symbol within the line
    

Discussion

  • stack trace

     
    Attachments
  • Elad Lahav
    Elad Lahav
    2007-10-30

    Logged In: YES
    user_id=378741
    Originator: NO

    This looks like an indication of a greater problem. You should not get a NULL pointer, since the token list is supposed to contain four entries. Since it doesn't happen for me, can you please try to track down what the list of tokens look like?