[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdebase/runtime/drkonqi
From:       George Kiagiadakis <kiagiadakis.george () gmail ! com>
Date:       2010-08-30 10:18:10
Message-ID: 20100830101810.8489DAC857 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1169926 by gkiagia:

Delete the old highlighter before regenerating a backtrace,
or else it may crash due to invalid iterators in the highlightBlock() function.
BUG: 249418

 M  +7 -2      backtracewidget.cpp  
 M  +2 -1      backtracewidget.h  
 M  +1 -0      gdbhighlighter.cpp  


--- trunk/KDE/kdebase/runtime/drkonqi/backtracewidget.cpp #1169925:1169926
@@ -44,7 +44,8 @@
 BacktraceWidget::BacktraceWidget(BacktraceGenerator *generator, QWidget *parent,
     bool showToggleBacktrace) :
         QWidget(parent),
-        m_btGenerator(generator)
+        m_btGenerator(generator),
+        m_highlighter(0)
 {
     ui.setupUi(this);
 
@@ -125,6 +126,10 @@
 
 void BacktraceWidget::setAsLoading()
 {
+    //remove the syntax highlighter
+    delete m_highlighter;
+    m_highlighter = 0;
+
     //Set the widget as loading and disable all the action buttons
     ui.m_backtraceEdit->setText(i18nc("@info:status", "Loading..."));
     ui.m_backtraceEdit->setEnabled(false);
@@ -212,7 +217,7 @@
 
         // highlight if possible
         if (m_btGenerator->debugger().codeName() == "gdb") {
-            new GdbHighlighter(ui.m_backtraceEdit->document(),
+            m_highlighter = new GdbHighlighter(ui.m_backtraceEdit->document(),
                                m_btGenerator->parser()->parsedBacktraceLines());
         }
 
--- trunk/KDE/kdebase/runtime/drkonqi/backtracewidget.h #1169925:1169926
@@ -25,6 +25,7 @@
 #include "debugpackageinstaller.h"
 #include "ui_backtracewidget.h"
 
+class QSyntaxHighlighter;
 class BacktraceRatingWidget;
 class BacktraceGenerator;
 
@@ -53,7 +54,7 @@
     BacktraceGenerator * m_btGenerator;
     Ui::Form    ui;
     BacktraceRatingWidget *   m_backtraceRatingWidget;
-
+    QSyntaxHighlighter *m_highlighter;
     DebugPackageInstaller * m_debugPackageInstaller;
     
 private Q_SLOTS:
--- trunk/KDE/kdebase/runtime/drkonqi/gdbhighlighter.cpp #1169925:1169926
@@ -68,6 +68,7 @@
         QString lineStr = text.mid(cur, diff).append('\n');
         // -1 since we skip the first line
         QMap< int, BacktraceLine >::iterator it = lines.lowerBound(lineNr - 1);
+        Q_ASSERT(it != lines.end());
         // lowerbound would return the next higher item, even though we want the former one
         if (it.key() > lineNr - 1) {
             --it;
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic