Bug 124102 - changing synxax highlighting back from HTML to Coldfusion when code is folded crashes katepart
Summary: changing synxax highlighting back from HTML to Coldfusion when code is folded...
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: part (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR crash (vote)
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-03-22 23:23 UTC by Matthew Mirus
Modified: 2006-06-25 23:04 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Mirus 2006-03-22 23:23:02 UTC
Version:            (using KDE KDE 3.5.1)
Installed from:    Unlisted Binary Package
Compiler:          gcc 4.0.3 
OS:                Linux

Opening a file with the .cfm extension uses Coldfusion syntax highlighting. I prefer to use HTML syntax highlighting most of the time, so I can use the code folding feature provided there. When switching back to the Coldfusion syntax highlighting from HTML when code is folded in the document being edited, Quanta crashes.

Here's the backtrace - http://www.trincomm.org/lbi/quanta-backtrace.txt

To reproduce:

1) Open a .cfm document in Quanta - this should activate Coldfusion syntax highlighting for that file.
2) Switch from Coldfusion syntax highlighting to HTML. (Tools -> Highlighting -> Markup -> HTML)
3) Fold some code by clicking the "-" on the left of the page.
4) Switch back to Coldfusion syntax highlighting.
Comment 1 András Manţia 2006-03-23 10:43:50 UTC
Confirmed with the current 3.5 branch as well. Katepart crashes when switching highlighting mode while some code is folded.
Comment 2 Matthew Mirus 2006-04-11 05:25:17 UTC
The backtrace is now available at http://65.163.5.201:850/quanta-backtrace.txt

Also, it seems to me, though I have little programming experience and none at all with KDE and katepart, that this crash could be prevented by checking for folded code and expanding it before switching syntax highlighting types when the user hits Tools -> Highlighting -> Markup -> Coldfusion.
Comment 3 Thiago Macieira 2006-04-11 08:55:54 UTC
Pasting the backtrace:
#6  0x416a7f93 in QGArray::find () from /opt/qt/lib/libqt-mt.so.3
#7  0x42a9dea5 in KateCodeFoldingTree::removeOpening ()
   from /opt/kde/lib/kde3/libkatepart.so
#8  0x42a9e156 in KateCodeFoldingTree::cleanupUnneededNodes ()
   from /opt/kde/lib/kde3/libkatepart.so
#9  0x42aa2c92 in KateCodeFoldingTree::updateLine ()
   from /opt/kde/lib/kde3/libkatepart.so
#10 0x42a75a4b in KateBuffer::doHighlight ()
   from /opt/kde/lib/kde3/libkatepart.so
#11 0x42a76841 in KateBuffer::line_internal ()
   from /opt/kde/lib/kde3/libkatepart.so
#12 0x42a93acc in KateCodeFoldingTree::toggleRegionVisibility ()
   from /opt/kde/lib/kde3/libkatepart.so
#13 0x42a9dfcf in KateCodeFoldingTree::removeOpening ()
   from /opt/kde/lib/kde3/libkatepart.so
#14 0x42a9e156 in KateCodeFoldingTree::cleanupUnneededNodes ()
   from /opt/kde/lib/kde3/libkatepart.so
#15 0x42aa2c92 in KateCodeFoldingTree::updateLine ()
   from /opt/kde/lib/kde3/libkatepart.so
#16 0x42a75a4b in KateBuffer::doHighlight ()
   from /opt/kde/lib/kde3/libkatepart.so
#17 0x42a76841 in KateBuffer::line_internal ()
   from /opt/kde/lib/kde3/libkatepart.so
#18 0x42a93acc in KateCodeFoldingTree::toggleRegionVisibility ()
   from /opt/kde/lib/kde3/libkatepart.so
#19 0x42a9dfcf in KateCodeFoldingTree::removeOpening ()
   from /opt/kde/lib/kde3/libkatepart.so
#20 0x42a9e156 in KateCodeFoldingTree::cleanupUnneededNodes ()
   from /opt/kde/lib/kde3/libkatepart.so
#21 0x42aa2c92 in KateCodeFoldingTree::updateLine ()
   from /opt/kde/lib/kde3/libkatepart.so
#22 0x42a75a4b in KateBuffer::doHighlight ()
   from /opt/kde/lib/kde3/libkatepart.so
#23 0x42a76841 in KateBuffer::line_internal ()
   from /opt/kde/lib/kde3/libkatepart.so
#24 0x42a7873e in KateViewInternal::range ()
   from /opt/kde/lib/kde3/libkatepart.so
#25 0x42a79b55 in KateViewInternal::range ()
   from /opt/kde/lib/kde3/libkatepart.so
#26 0x42a7f0d0 in KateViewInternal::updateView ()
   from /opt/kde/lib/kde3/libkatepart.so
#27 0x42a84706 in KateView::updateView () from /opt/kde/lib/kde3/libkatepart.so
#28 0x42a847b2 in KateDocument::tagAll () from /opt/kde/lib/kde3/libkatepart.so
#29 0x42a8480d in KateDocument::makeAttribs ()
   from /opt/kde/lib/kde3/libkatepart.so
#30 0x42a84888 in KateDocument::bufferHlChanged ()
   from /opt/kde/lib/kde3/libkatepart.so
#31 0x42a84942 in KateBuffer::setHighlight ()
   from /opt/kde/lib/kde3/libkatepart.so
#32 0x42a8586f in KateDocument::setHlMode ()
   from /opt/kde/lib/kde3/libkatepart.so
#33 0x429df250 in KateViewHighlightAction::setHl ()
   from /opt/kde/lib/kde3/libkatepart.so
#34 0x42a36862 in KateViewHighlightAction::qt_invoke ()
   from /opt/kde/lib/kde3/libkatepart.so
#35 0x413f5f09 in QObject::activate_signal () from /opt/qt/lib/libqt-mt.so.3
#36 0x413f64d1 in QObject::activate_signal () from /opt/qt/lib/libqt-mt.so.3
#37 0x41730e61 in QSignal::intSignal () from /opt/qt/lib/libqt-mt.so.3
#38 0x414128a5 in QSignal::activate () from /opt/qt/lib/libqt-mt.so.3
#39 0x414fce08 in QPopupMenu::mouseReleaseEvent ()
   from /opt/qt/lib/libqt-mt.so.3
#40 0x4142f938 in QWidget::event () from /opt/qt/lib/libqt-mt.so.3
#41 0x41396b51 in QApplication::internalNotify ()
   from /opt/qt/lib/libqt-mt.so.3
#42 0x41397bc2 in QApplication::notify () from /opt/qt/lib/libqt-mt.so.3
#43 0x40ffe03e in KApplication::notify () from /opt/kde/lib/libkdecore.so.4
#44 0x41332a3a in QETWidget::translateMouseEvent ()
   from /opt/qt/lib/libqt-mt.so.3
#45 0x413312e4 in QApplication::x11ProcessEvent ()
   from /opt/qt/lib/libqt-mt.so.3
#46 0x41344eaa in QEventLoop::processEvents () from /opt/qt/lib/libqt-mt.so.3
#47 0x413ad669 in QEventLoop::enterLoop () from /opt/qt/lib/libqt-mt.so.3
#48 0x413ad566 in QEventLoop::exec () from /opt/qt/lib/libqt-mt.so.3
#49 0x4139656f in QApplication::exec () from /opt/qt/lib/libqt-mt.so.3
Comment 4 Dominik Haumann 2006-05-23 17:25:52 UTC
Interesting part: Katepart crashes when switching highlighting mode while some code is folded.

*** This bug has been marked as a duplicate of 89042 ***
Comment 5 Dominik Haumann 2006-06-23 16:58:32 UTC
not a duplicate, fix will follow.
Comment 6 Dominik Haumann 2006-06-23 17:06:05 UTC
SVN commit 554261 by dhaumann:

fix crash, if there are folded regions and then highlighting is changed

BUG: 124102


 M  +4 -0      katebuffer.cpp  


--- branches/KDE/3.5/kdelibs/kate/part/katebuffer.cpp #554260:554261
@@ -870,6 +870,10 @@
 
     h->use();
 
+    // Clear code folding tree (see bug #124102)
+    m_regionTree.clear();
+    m_regionTree.fixRoot(m_lines);
+
     // try to set indentation
     if (!h->indentation().isEmpty())
       m_doc->config()->setIndentationMode (KateAutoIndent::modeNumber(h->indentation()));
Comment 7 Dominik Haumann 2006-06-25 23:04:46 UTC
SVN commit 554960 by dhaumann:

forward port SVN commit 554261 by dhaumann:
fix crash, if there are folded regions and then highlighting is changed

CCBUG: 124102


 M  +4 -0      katebuffer.cpp  


--- trunk/KDE/kdelibs/kate/part/katebuffer.cpp #554959:554960
@@ -692,6 +692,10 @@
 
     h->use();
 
+    // Clear code folding tree (see bug #124102)
+    m_regionTree.clear();
+    m_regionTree.fixRoot(m_lines.size());
+
     // try to set indentation
     if (!h->indentation().isEmpty())
       m_doc->config()->setIndentationMode (KateAutoIndent::modeNumber(h->indentation()));