Crashes with cyclic class dependency graph

David Nolden zwabel at
Sun Feb 14 13:47:01 UTC 2010

Am Sonntag 14 Februar 2010 13:10:45 schrieb Nicolai Haehnle:
> Hello,
> I've run into a weird problem with the cppduchain code. Consider the
> following (obviously incorrect) code:
> struct B;
> struct A : B {};
> struct B : A {};
> void test() {
>    B b;
> }
> You're pretty much guaranteed to hit a crash after a little bit of
> editing. The reason for all these different crashes is that many
> places in the code traverse the dependency graph recursively, and
> they're bound to run out of stack pretty quickly. Of course the above
> code is incorrect, but KDevelop should obviously not crash. What is
> the preferred solution for this, though? Forbid the introduction of
> cycles into the dependency graph while parsing the code? And how would
> one achieve that?
> Incidentally, I ran into this problem on completely valid code, where
> the parser apparently didn't understand namespaces correctly; but
> that's I separate issue which I'm going to investigate separately now.

Some of the relevant traversal-functions already have protections against 
endless recursion, and those that don't have it should get it. So post the 
backtrace please so we can see what function is the culprit.

Greetings, David

More information about the KDevelop-devel mailing list