Bug 137157 - infinite loop in C style indenting mode
Summary: infinite loop in C style indenting mode
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR major
Target Milestone: ---
Assignee: Leo Savernik
URL:
Keywords:
: 138791 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-11-10 16:01 UTC by Dennis Noordsij
Modified: 2006-12-15 18:19 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Test case for reported behaviour (217 bytes, text/plain)
2006-11-10 16:03 UTC, Dennis Noordsij
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dennis Noordsij 2006-11-10 16:01:18 UTC
Version:            (using KDE KDE 3.5.5)
Installed from:    Compiled From Sources
Compiler:          gcc version 3.4.4 (Gentoo 3.4.4-r1, ssp-3.4.4-1.0, pie-8.7.8)
 
OS:                Linux

(technically not a crash, but just as bad as the app stops responding altogether).

If one opens the following file in Kate, with syntax highlighting (C) and indentation turned on (C-Style), then going to the end of the "while .." line and pressing enter twice, the indenting goes into an infinite loop. Only way out is to kill kate.

Not extensive but perhaps useful:

#0  0xb65773a4 in KateBufBlock::line () from /usr/kde/3.5/lib/kde3/libkatepart.so
#1  0xb65f6557 in KateBuffer::plainLine () from /usr/kde/3.5/lib/kde3/libkatepart.so
#2  0xb657c185 in KateDocCursor::currentAttrib () from /usr/kde/3.5/lib/kde3/libkatepart.so
#3  0xb657def9 in KateNormalIndent::isBalanced () from /usr/kde/3.5/lib/kde3/libkatepart.so
#4  0xb657e29b in KateCSmartIndent::calcContinue () from /usr/kde/3.5/lib/kde3/libkatepart.so
#5  0xb657e595 in KateCSmartIndent::calcContinue () from /usr/kde/3.5/lib/kde3/libkatepart.so
#6  0xb657f412 in KateCSmartIndent::calcIndent () from /usr/kde/3.5/lib/kde3/libkatepart.so
#7  0xb657f9e6 in KateCSmartIndent::processNewline () from /usr/kde/3.5/lib/kde3/libkatepart.so
#8  0xb65cdf9f in KateDocument::newLine () from /usr/kde/3.5/lib/kde3/libkatepart.so
#9  0xb65ce1a4 in KateViewInternal::doReturn () from /usr/kde/3.5/lib/kde3/libkatepart.so
#10 0xb65f9fc3 in KateView::keyReturn () from /usr/kde/3.5/lib/kde3/libkatepart.so
#11 0xb65cce00 in KateViewInternal::keyPressEvent () from /usr/kde/3.5/lib/kde3/libkatepart.so
#12 0xb65b29d7 in KateViewInternal::eventFilter () from /usr/kde/3.5/lib/kde3/libkatepart.so
#13 0xb6dfc96f in QObject::activate_filters () from /usr/qt/3/lib/libqt-mt.so.3
#14 0xb6dfca44 in QObject::event () from /usr/qt/3/lib/libqt-mt.so.3
#15 0xb6e391cc in QWidget::event () from /usr/qt/3/lib/libqt-mt.so.3
#16 0xb6d99bbf in QApplication::internalNotify () from /usr/qt/3/lib/libqt-mt.so.3
#17 0xb6d9a3b6 in QApplication::notify () from /usr/qt/3/lib/libqt-mt.so.3
#18 0xb7514fa5 in KApplication::notify () from /usr/kde/3.5/lib/libkdecore.so.4
#19 0xb6d28dd8 in QETWidget::translateKeyEvent () from /usr/qt/3/lib/libqt-mt.so.3
#20 0xb6d3035c in QApplication::x11ProcessEvent () from /usr/qt/3/lib/libqt-mt.so.3
#21 0xb6d448a5 in QEventLoop::processEvents () from /usr/qt/3/lib/libqt-mt.so.3
#22 0xb6db05d1 in QEventLoop::enterLoop () from /usr/qt/3/lib/libqt-mt.so.3
#23 0xb6db0516 in QEventLoop::exec () from /usr/qt/3/lib/libqt-mt.so.3
#24 0xb6d98d0f in QApplication::exec () from /usr/qt/3/lib/libqt-mt.so.3
#25 0xb7f14ff6 in kdemain () from /usr/kde/3.5/lib/libkdeinit_kate.so

is the backtrace if one presses ctrl-c in gdb to stop the infinite loop.

I have to attach this file since if I copy-paste the text into kate it doesn't work (spacing/tabs/indenting is done properly from the beginning I guess). You have to open it as is.

Can't attach a file in the initial bug report so bear with me as I add it in a sec once the report exists.

(PS it's not my code :)
Comment 1 Dennis Noordsij 2006-11-10 16:03:22 UTC
Created attachment 18490 [details]
Test case for reported behaviour

Turn on C highlighting and C-style indenting.
Load into Kate.
Go to end of "while" line (should be last line in test case).
Press enter twice.
Comment 2 Philip Rodrigues 2006-11-11 22:44:35 UTC
Confirmed on r601002
Comment 3 Leo Savernik 2006-11-13 00:11:44 UTC
sigh, not wondering why nobody dared to touch the indenter code for years
Comment 4 Dominik Haumann 2006-11-13 10:57:29 UTC
Is that a regression we introduced by our recent changes, or does it exist in e.g. 3.5.0 as well?
Comment 5 Leo Savernik 2006-11-15 20:03:51 UTC
Testcase is wrong. I can only reproduce if no trailing newlines follow. Preparing fix.

@Dominik: I think it is a recent regression. Otherwise, we'd have received such a bug much earlier.
Comment 6 Dominik Haumann 2006-12-15 09:11:49 UTC
Leo: this is fixed with your commit r605213, right?
Comment 7 Marcus Daub 2006-12-15 10:15:17 UTC
Unfortunately it seems to be that I opened a duplicate of this bug-report:
http://bugs.kde.org/show_bug.cgi?id=138791
Please have a look.
Thanks!
Comment 8 Leo Savernik 2006-12-15 18:17:46 UTC
Indeed, already fixed for KDE 3.5.6 as of r605213.
Comment 9 Leo Savernik 2006-12-15 18:19:16 UTC
*** Bug 138791 has been marked as a duplicate of this bug. ***