https://bugs.kde.org/show_bug.cgi?id=435500

--- Comment #7 from Igor Kushnir <igor...@gmail.com> ---
Applied two QDebug patches (see below) on top of the incomplete
4775bd1ffe272a1e3367510ff6d440bf1b8f2a13.patch fix. None of the assertions in
KateLayoutCache::line(int realLine, int virtualLine) has been triggered because
m_lineLayouts.contains(realLine) was false. The crash with the same backtrace
occurred.

journalctl --user --since today | tail -n 5
Apr 13 10:44:12 Igor-Manjaro kdevelop[265803]: 1060 1064
Apr 13 10:44:12 Igor-Manjaro kdevelop[265803]: 1061 1064
Apr 13 10:44:12 Igor-Manjaro kdevelop[265803]: 1062 1064
Apr 13 10:44:12 Igor-Manjaro kdevelop[265803]: 1063 1064
Apr 13 10:44:12 Igor-Manjaro kdevelop[265803]: (1058, 51) (1058, 90) (1194, 51)
1057 KateLayoutCache(0x559f82899850)

Output analysis: m_renderer->doc()->buffer().lines() equals 1064, startCur and
endCur are valid, but toRealCursor(startCur) increases the line from 1058 to
1194, which is out of range.

The patches:
--- kateviewinternal.cpp        2021-04-12 15:11:20.921123962 +0300
+++ kateviewinternal-patched.cpp        2021-04-13 10:35:04.875816568 +0300
@@ -42,6 +42,7 @@
 #include <QAccessible>
 #include <QApplication>
 #include <QClipboard>
+#include <QDebug>
 #include <QKeyEvent>
 #include <QLayout>
 #include <QMimeData>
@@ -3524,6 +3525,7 @@
     int sX = 0;
     if (startLine == startCur.line()) {
         auto rc = toRealCursor(startCur);
+        qCritical() << startCur << endCur << rc << endLine << cache();
         sX = renderer()->cursorToX(cache()->textLayout(rc), rc,
!view()->wrapCursor());
     }


--- katelayoutcache.cpp 2021-04-12 15:11:20.921123962 +0300
+++ katelayoutcache-patched.cpp 2021-04-13 10:39:17.911636773 +0300
@@ -5,6 +5,8 @@
     SPDX-License-Identifier: LGPL-2.0-or-later
 */

+#define QT_FORCE_ASSERTS
+
 #include "katelayoutcache.h"

 #include <QtAlgorithms>
@@ -15,6 +17,8 @@
 #include "katerenderer.h"
 #include "kateview.h"

+#include <QDebug>
+
 namespace
 {
 bool enableLayoutCache = false;
@@ -271,6 +275,7 @@
         KateLineLayoutPtr l = m_lineLayouts[realLine];

         // ensure line is OK
+        qCritical() << l->line() << m_renderer->doc()->buffer().lines();
         Q_ASSERT(l->line() == realLine);
         Q_ASSERT(realLine < m_renderer->doc()->buffer().lines());

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to