<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.kde.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugs.kde.org/"
          
          maintainer="sysadmin@kde.org"
>

    <bug>
          <bug_id>137157</bug_id>
          
          <creation_ts>2006-11-10 16:01:18 +0000</creation_ts>
          <short_desc>infinite loop in C style indenting mode</short_desc>
          <delta_ts>2006-12-15 18:19:16 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>2</classification_id>
          <classification>Applications</classification>
          <product>kate</product>
          <component>general</component>
          <version>unspecified</version>
          <rep_platform>Compiled Sources</rep_platform>
          <op_sys>Linux</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>NOR</priority>
          <bug_severity>major</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Dennis Noordsij">dennis.noordsij</reporter>
          <assigned_to name="Leo Savernik">l.savernik</assigned_to>
          <cc>m.daub</cc>
          
          <cf_commitlink></cf_commitlink>
          <cf_versionfixedin></cf_versionfixedin>
          <cf_sentryurl></cf_sentryurl>
          <votes>0</votes>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>485703</commentid>
    <comment_count>0</comment_count>
    <who name="Dennis Noordsij">dennis.noordsij</who>
    <bug_when>2006-11-10 16:01:18 +0000</bug_when>
    <thetext>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 &quot;while ..&quot; 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&apos;t work (spacing/tabs/indenting is done properly from the beginning I guess). You have to open it as is.

Can&apos;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&apos;s not my code :)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>485704</commentid>
    <comment_count>1</comment_count>
      <attachid>18490</attachid>
    <who name="Dennis Noordsij">dennis.noordsij</who>
    <bug_when>2006-11-10 16:03:22 +0000</bug_when>
    <thetext>Created attachment 18490
Test case for reported behaviour

Turn on C highlighting and C-style indenting.
Load into Kate.
Go to end of &quot;while&quot; line (should be last line in test case).
Press enter twice.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>485995</commentid>
    <comment_count>2</comment_count>
    <who name="Philip Rodrigues">phil</who>
    <bug_when>2006-11-11 22:44:35 +0000</bug_when>
    <thetext>Confirmed on r601002</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>486242</commentid>
    <comment_count>3</comment_count>
    <who name="Leo Savernik">l.savernik</who>
    <bug_when>2006-11-13 00:11:44 +0000</bug_when>
    <thetext>sigh, not wondering why nobody dared to touch the indenter code for years</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>486331</commentid>
    <comment_count>4</comment_count>
    <who name="Dominik Haumann">dhaumann</who>
    <bug_when>2006-11-13 10:57:29 +0000</bug_when>
    <thetext>Is that a regression we introduced by our recent changes, or does it exist in e.g. 3.5.0 as well?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>486994</commentid>
    <comment_count>5</comment_count>
    <who name="Leo Savernik">l.savernik</who>
    <bug_when>2006-11-15 20:03:51 +0000</bug_when>
    <thetext>Testcase is wrong. I can only reproduce if no trailing newlines follow. Preparing fix.

@Dominik: I think it is a recent regression. Otherwise, we&apos;d have received such a bug much earlier.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>493884</commentid>
    <comment_count>6</comment_count>
    <who name="Dominik Haumann">dhaumann</who>
    <bug_when>2006-12-15 09:11:49 +0000</bug_when>
    <thetext>Leo: this is fixed with your commit r605213, right?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>493900</commentid>
    <comment_count>7</comment_count>
    <who name="Marcus Daub">m.daub</who>
    <bug_when>2006-12-15 10:15:17 +0000</bug_when>
    <thetext>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!</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>493957</commentid>
    <comment_count>8</comment_count>
    <who name="Leo Savernik">l.savernik</who>
    <bug_when>2006-12-15 18:17:46 +0000</bug_when>
    <thetext>Indeed, already fixed for KDE 3.5.6 as of r605213.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>493959</commentid>
    <comment_count>9</comment_count>
    <who name="Leo Savernik">l.savernik</who>
    <bug_when>2006-12-15 18:19:16 +0000</bug_when>
    <thetext>*** Bug 138791 has been marked as a duplicate of this bug. ***</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>18490</attachid>
            <date>2006-11-10 16:03:22 +0000</date>
            <delta_ts>2006-11-10 16:03:22 +0000</delta_ts>
            <desc>Test case for reported behaviour</desc>
            <filename>ex1_6b.c</filename>
            <type>text/plain</type>
            <size>217</size>
            <attacher name="Dennis Noordsij">dennis.noordsij</attacher>
            
              <data encoding="base64">IyBpbmNsdWRlIDxzdGRpby5oPgojIGluY2x1ZGUgPHN0ZGxpYi5oPgojIGluY2x1ZGUgPHN0cmlu
Zy5oPgoKCglkbyB7CgkJcHJpbnRmKCJUZXN0ICIpOwoJCXNjYW5mKCIlMjU1cyIsZmlsZW5hbWUp
OwoJCWlmIChzdHJjbXAoZmlsZW5hbWUsInF1aXQiKT09MCkgZXhpdCgwKTsKIAoJCW15X2ZpbGU9
Zm9wZW4oZmlsZW5hbWUsICJydCIpOwoJfQoJd2hpbGUgKG15X2ZpbGU9PTApOw==
</data>

          </attachment>
      

    </bug>

</bugzilla>