Bug 82169 - Crash because of inheritance loop
Summary: Crash because of inheritance loop
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: Language Support: CPP (old) (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: KDevelop Developers
URL:
Keywords:
: 81327 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-05-25 15:40 UTC by Christoph Bartoschek
Modified: 2013-03-31 00:52 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christoph Bartoschek 2004-05-25 15:40:09 UTC
Version:            (using KDE KDE 3.2.2)
Installed from:    Compiled From Sources
Compiler:          g++ 3.4.0 
OS:                Linux

Today I made the mistake to write a class which inherits itself. First I did not recognice the problem and tried to call a method of the class. Each time I wrote  instance.  kdevelop crashed, when instance was an object of my class.

I think my class created a cycle in the CodeCompletition Class Store. During the search for all member methods of my class a endless loop was entered and left after stack or heap exhaustion.

Here is how to reproduce the problem:

1. Start a console "Hello World" C++ Project.
2. Add a new file Header.H
3. Insert the following code into the new file:

class Murti : public Murti
{
public:
   static int size();
};

4. Save the file.
5. Go to the main file and type into the main function:

int main() {
Murti a;
a.
}

After you type the dot kdevelop begins to calculate and eventually crashes. 

You can also write  Murti:: and it crashes. I think it does not matter where you write Murti::, it will crash. 


kdevelop should not crash because of such an error. However it would be better if the parser
recognized the error and indicated it to the programmer.
Comment 1 Christoph Bartoschek 2004-05-26 22:30:24 UTC
Here is a backtrace:

#0  0x40f31ca9 in malloc (bytes=12) at malloc.c:5505
#1  0x41c63d3e in operator new(unsigned) (sz=12) at ../../../../gcc-3.4.0/libstdc++-v3/libsupc++/new_op.cc:48
#2  0x416483bd in QGArray::newData() (this=0xbf8012a0) at tools/qgarray.cpp:812
#3  0x4164700e in QGArray (this=0xbf8012a0, size=127) at tools/qgarray.cpp:142
#4  0x41639d50 in QMemArray (this=0xbf8012a0, size=127) at qmemarray.h:59
#5  0x41636e8d in QCString (this=0xbf8012a0, size=127) at tools/qcstring.cpp:679
#6  0x416a10aa in QUtf8Codec::fromUnicode(QString const&, int&) const (this=0x80a9960, uc=@0xbf8015b0, lenInOut=@0xbf80014c) at codecs/qutfcodec.cpp:53
#7  0x4169b4ce in QTextCodec::fromUnicode(QString const&) const (this=0x80a9960, uc=@0xbf8015b0) at codecs/qtextcodec.cpp:997
#8  0x416771bd in QString::local8Bit() const (this=0xbf8015b0) at tools/qstring.cpp:5838
#9  0x40df78db in kdbgstream::flush() (this=0xbf8015b0) at qmemarray.h:64
#10 0x08062ae7 in endl(kdbgstream&) (s=@0xbf8015b0) at kdebug.h:201
#11 0x42c92cc9 in CppCodeCompletion::findContainer(QString const&, KSharedPtr<NamespaceModel>, bool) (this=0x8b0c730, name=@0xbf801a60, container=
      {ptr = 0x8200a08}, includeImports=false) at kdebug.h:229
#12 0x42c92c20 in CppCodeCompletion::findContainer(QString const&, KSharedPtr<NamespaceModel>, bool) (this=0x8b0c730, name=@0xbf801a60, container=
      {ptr = 0x0}, includeImports=false) at qguardedptr.h:113
#13 0x42c9599a in CppCodeCompletion::computeCompletionEntryList(QValueList<KTextEditor::CompletionEntry>&, QStringList const&, bool) (this=0x8b0c730, 
    entryList=@0xbfffe1b0, type=@0xbf801ab0, isInstance=false) at ksharedptr.h:61
#14 0x42c96c56 in CppCodeCompletion::computeCompletionEntryList(QValueList<KTextEditor::CompletionEntry>&, KSharedPtr<ClassModel>, bool) (
    this=0x8b0c730, entryList=@0xbfffe1b0, klass={ptr = 0x8c10218}, isInstance=false) at cppcodecompletion.cpp:1545
#15 0x42c959e4 in CppCodeCompletion::computeCompletionEntryList(QValueList<KTextEditor::CompletionEntry>&, QStringList const&, bool) (this=0x8b0c730, 
    entryList=@0xbfffe1b0, type=@0xbf801d30, isInstance=false) at ksharedptr.h:61
#16 0x42c96c56 in CppCodeCompletion::computeCompletionEntryList(QValueList<KTextEditor::CompletionEntry>&, KSharedPtr<ClassModel>, bool) (
    this=0x8b0c730, entryList=@0xbfffe1b0, klass={ptr = 0x8c10218}, isInstance=false) at cppcodecompletion.cpp:1545

...

#26174 0x42c96c56 in CppCodeCompletion::computeCompletionEntryList(QValueList<KTextEditor::CompletionEntry>&, KSharedPtr<ClassModel>, bool) (
    this=0x8b0c730, entryList=@0xbfffe1b0, klass={ptr = 0x8c10218}, isInstance=false) at cppcodecompletion.cpp:1545
#26175 0x42c959e4 in CppCodeCompletion::computeCompletionEntryList(QValueList<KTextEditor::CompletionEntry>&, QStringList const&, bool) (this=0x8b0c730, 
    entryList=@0xbfffe1b0, type=@0xbfffd930, isInstance=false) at ksharedptr.h:61
#26176 0x42c96c56 in CppCodeCompletion::computeCompletionEntryList(QValueList<KTextEditor::CompletionEntry>&, KSharedPtr<ClassModel>, bool) (
    this=0x8b0c730, entryList=@0xbfffe1b0, klass={ptr = 0x8c10218}, isInstance=false) at cppcodecompletion.cpp:1545
#26177 0x42c959e4 in CppCodeCompletion::computeCompletionEntryList(QValueList<KTextEditor::CompletionEntry>&, QStringList const&, bool) (this=0x8b0c730, 
    entryList=@0xbfffe1b0, type=@0xbfffe180, isInstance=false) at ksharedptr.h:61
#26178 0x42c9b746 in CppCodeCompletion::completeText() (this=0x8b0c730) at cppcodecompletion.cpp:932
#26179 0x42c9dc9b in CppCodeCompletion::slotTimeout() (this=0x8b7b3c8) at cppcodecompletion.cpp:314
#26180 0x42c9df06 in CppCodeCompletion::qt_invoke(int, QUObject*) (this=0x8b0c730, _id=146256840, _o=0x8b7b3c8) at cppcodecompletion.moc:117
#26181 0x4130d192 in QObject::activate_signal(QConnectionList*, QUObject*) (this=0x8b0c680, clist=0x8b0caa8, o=0xbfffe3c0) at kernel/qobject.cpp:2356
#26182 0x4130cfed in QObject::activate_signal(int) (this=0x8b0c680, signal=2) at kernel/qobject.cpp:2325
#26183 0x416ec000 in QTimer::timeout() (this=0x8b0c680) at .moc/debug-shared-mt/moc_qtimer.cpp:82
#26184 0x4133938e in QTimer::event(QEvent*) (this=0x8b0c680, e=0xbfffe6a0) at kernel/qtimer.cpp:219
#26185 0x4129ce51 in QApplication::internalNotify(QObject*, QEvent*) (this=0xbfffea10, receiver=0x8b0c680, e=0xbfffe6a0) at kernel/qapplication.cpp:2620
#26186 0x4129c2e1 in QApplication::notify(QObject*, QEvent*) (this=0xbfffea10, receiver=0x8b0c680, e=0xbfffe6a0) at kernel/qapplication.cpp:2343
#26187 0x40de9dd2 in KApplication::notify(QObject*, QEvent*) (this=0xbfffea10, receiver=0x8b0c680, event=0xbfffe6a0) at kapplication.cpp:507
#26188 0x41224122 in QApplication::sendEvent(QObject*, QEvent*) (receiver=0x8b0c680, event=0xbfffe6a0) at qapplication.h:491
#26189 0x412886f5 in QEventLoop::activateTimers() (this=0x8169b60) at kernel/qeventloop_unix.cpp:558
#26190 0x41239366 in QEventLoop::processEvents(unsigned) (this=0x8169b60, flags=4) at kernel/qeventloop_x11.cpp:389
#26191 0x412b4ad7 in QEventLoop::enterLoop() (this=0x8169b60) at kernel/qeventloop.cpp:198
#26192 0x412b49f2 in QEventLoop::exec() (this=0x8169b60) at kernel/qeventloop.cpp:145
#26193 0x4129cfe5 in QApplication::exec() (this=0xbfffea10) at kernel/qapplication.cpp:2743
#26194 0x08062847 in main (argc=-1082125664, argv=0xbf8012a0) at main.cpp:128
#26195 0x42015704 in __libc_start_main () from /lib/tls/libc.so.6
Comment 2 Sascha Cunz 2004-06-04 02:10:37 UTC
Yay. That backtrace looks really bad. However, i could not make it happen with current cvs ( but i could not make it CC in new project at all ?!?).

However this is a cpp-parser issue.
Comment 3 Jesse 2004-07-29 06:17:51 UTC
*** Bug 81327 has been marked as a duplicate of this bug. ***
Comment 4 Christoph Bartoschek 2004-09-13 23:04:50 UTC
I still get this error with kdevelop 3.1 from kde 3.3
Comment 5 Anne-Marie Mahfouf 2004-09-14 00:13:45 UTC
confirmed here: from konsole
kdevelop (cpp support): has namespace Murti: false
kdevelop (cpp support): find class: Murti in namespace ::
kdevelop (cpp support): found class: Murti
kdevelop (cpp support): found class: Murti
kdevelop (cpp support): -----------> findContainer name: Murti
kdevelop (cpp support): -----------> findContainer name: Murti ::

in a loop. 
kdevelop cvs HEAD 11th 09 2004 with KDE cvs HEAD
Comment 6 David Nolden 2006-05-24 05:38:14 UTC
Resolved in current svn!
Comment 7 Aleix Pol 2013-03-31 00:52:29 UTC
Moving all the bugs from the CPP Parser. It was not well defined the difference between it and C++ Language Support and people kept reporting in both places indistinctively