Bug 435628 - Crash trying to open a displaced closed folding marker
Summary: Crash trying to open a displaced closed folding marker
Status: RESOLVED FIXED
Alias: None
Product: frameworks-ktexteditor
Classification: Frameworks and Libraries
Component: general (other bugs)
Version First Reported In: unspecified
Platform: openSUSE Linux
: NOR crash
Target Milestone: ---
Assignee: KWrite Developers
URL:
Keywords: drkonqi
Depends on:
Blocks:
 
Reported: 2021-04-11 20:04 UTC by Jaime Torres
Modified: 2022-08-11 05:46 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments
Folding gone crazy (17.39 KB, image/png)
2022-01-08 17:11 UTC, Jaime Torres
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jaime Torres 2021-04-11 20:04:27 UTC
Application: kdevelop (5.6.2)

Qt Version: 5.15.2
Frameworks Version: 5.80.0
Operating System: Linux 5.11.11-1-default x86_64
Windowing System: X11
Drkonqi Version: 5.21.3
Distribution: "openSUSE Tumbleweed"

-- Information about the crash:
- What I was doing when the application crashed:
Working in a python module with several classes and methods, in a previuos session I folded/closed several classes, kept working on the last class and exited kdevelop cleanly.
When I started it again, the folding markers are displaced and the classes are folded in strange ways.
Trying to open one of them created the crash.

The reporter is unsure if this crash is reproducible.

-- Backtrace:
Application: KDevelop (kdevelop), signal: Segmentation fault
Content of s_kcrashErrorMessage: [Current thread is 1 (LWP 8973)]
[KCrash Handler]
#6  0x00007fa14c445efe in QString::insert (s=..., i=223, this=0x558729621c68) at ../../include/QtCore/../../src/corelib/text/qstring.h:542
#7  QTextEngine::validate (this=0x55872b024fe0) at text/qtextengine.cpp:2077
#8  QTextEngine::validate (this=0x55872b024fe0) at text/qtextengine.cpp:2059
#9  0x00007fa14c44caba in QTextEngine::itemize (this=0x55872b024fe0) at text/qtextengine.cpp:2082
#10 0x00007fa14c45565c in QTextLayout::beginLayout (this=this@entry=0x5587297a8ab0) at text/qtextlayout.cpp:659
#11 0x00007fa14a1c5c18 in KateRenderer::layoutLine (this=0x7fffce03c4e0, this@entry=0x55872a6a0f40, lineLayout=..., maxwidth=maxwidth@entry=1251, cacheLayout=<optimized out>) at /usr/src/debug/ktexteditor-5.80.0-1.1.x86_64/src/render/katerenderer.cpp:998
#12 0x00007fa14a1c64b1 in KateLayoutCache::line (this=0x7fffce03c7b8, this@entry=0x55872a6a0e00, realLine=realLine@entry=1285, virtualLine=virtualLine@entry=1285) at /usr/src/debug/ktexteditor-5.80.0-1.1.x86_64/src/render/katelayoutcache.cpp:284
#13 0x00007fa14a1c6ea2 in KateLayoutCache::updateViewCache (this=0x55872a6a0e00, startPos=..., newViewLineCount=<optimized out>, viewLinesScrolled=<optimized out>) at /usr/src/debug/ktexteditor-5.80.0-1.1.x86_64/src/render/katelayoutcache.cpp:258
#14 0x00007fa14a2164da in KateViewInternal::tagLines (this=0x55872a684580, start=..., end=..., realCursors=<optimized out>) at /usr/src/debug/ktexteditor-5.80.0-1.1.x86_64/src/view/kateviewinternal.cpp:2378
#15 0x00007fa14be3a946 in QtPrivate::QSlotObjectBase::call (a=0x7fffce03c9e0, r=0x55872a6835f0, this=0x55872a7f40c0) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#16 doActivate<false> (sender=0x558728ceb660, signal_index=3, argv=0x7fffce03c9e0) at kernel/qobject.cpp:3886
#17 0x00007fa0e74397c2 in ProblemReporterPlugin::updateHighlight (this=this@entry=0x5587281a3330, url=...) at /usr/src/debug/kdevelop5-5.6.2-1.3.x86_64/plugins/problemreporter/problemreporterplugin.cpp:180
#18 0x00007fa0e7439f3b in ProblemReporterPlugin::updateOpenedDocumentsHighlight (this=0x5587281a3330) at /usr/src/debug/kdevelop5-5.6.2-1.3.x86_64/plugins/problemreporter/problemreporterplugin.cpp:257
#19 0x00007fa14be3a946 in QtPrivate::QSlotObjectBase::call (a=0x7fffce03cbb0, r=0x5587281a3330, this=0x5587281b2010) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#20 doActivate<false> (sender=0x558727844740, signal_index=6, argv=0x7fffce03cbb0) at kernel/qobject.cpp:3886
#21 0x00007fa14be3a946 in QtPrivate::QSlotObjectBase::call (a=0x7fffce03cc90, r=0x558727844740, this=0x5587281acb40) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#22 doActivate<false> (sender=0x5587281aa670, signal_index=26, argv=0x7fffce03cc90) at kernel/qobject.cpp:3886
#23 0x00007fa14be3a946 in QtPrivate::QSlotObjectBase::call (a=0x7fffce03cd70, r=0x5587281aa670, this=0x5587281ac4b0) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#24 doActivate<false> (sender=0x5587281a3300, signal_index=4, argv=0x7fffce03cd70) at kernel/qobject.cpp:3886
#25 0x00007fa0e743cd67 in ProblemReporterModel::rebuildProblemList (this=0x5587281aa670) at /usr/src/debug/kdevelop5-5.6.2-1.3.x86_64/plugins/problemreporter/problemreportermodel.cpp:166
#26 0x00007fa14be3a946 in QtPrivate::QSlotObjectBase::call (a=0x7fffce03cea0, r=0x5587281aa670, this=0x5587281ac970) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#27 doActivate<false> (sender=0x5587281a3300, signal_index=3, argv=0x7fffce03cea0) at kernel/qobject.cpp:3886
#28 0x00007fa14be3a946 in QtPrivate::QSlotObjectBase::call (a=0x7fffce03cf80, r=0x5587281a3300, this=0x55872ac9c6e0) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#29 doActivate<false> (sender=0x5587281ab560, signal_index=3, argv=0x7fffce03cf80) at kernel/qobject.cpp:3886
#30 0x00007fa14d7d20b9 in KDevelop::WatchedDocumentSetPrivate::doUpdate (flags=..., this=0x5587281a8f30) at /usr/src/debug/kdevelop5-5.6.2-1.3.x86_64/kdevplatform/shell/watcheddocumentset.cpp:95
#31 KDevelop::WatchedDocumentSetPrivate::setDocuments (flags=..., docs=..., this=0x5587281a8f30) at /usr/src/debug/kdevelop5-5.6.2-1.3.x86_64/kdevplatform/shell/watcheddocumentset.cpp:101
#32 KDevelop::CurrentDocumentSet::setCurrentDocument (this=<optimized out>, url=...) at /usr/src/debug/kdevelop5-5.6.2-1.3.x86_64/kdevplatform/shell/watcheddocumentset.cpp:243
#33 0x00007fa0e743ae1e in ProblemReporterModel::setCurrentDocument (this=0x5587281aa670, doc=0x7fffce03d04c) at /usr/src/debug/kdevelop5-5.6.2-1.3.x86_64/plugins/problemreporter/problemreportermodel.cpp:135
#34 0x00007fa14be3a946 in QtPrivate::QSlotObjectBase::call (a=0x7fffce03d180, r=0x5587281aa670, this=0x5587281aa590) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#35 doActivate<false> (sender=0x558727828880, signal_index=3, argv=argv@entry=0x7fffce03d180) at kernel/qobject.cpp:3886
#36 0x00007fa14be33c60 in QMetaObject::activate (sender=<optimized out>, m=m@entry=0x7fa14d662260 <KDevelop::IDocumentController::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7fffce03d180) at kernel/qobject.cpp:3946
#37 0x00007fa14d64860f in KDevelop::IDocumentController::documentActivated (this=<optimized out>, _t1=<optimized out>) at /usr/src/debug/kdevelop5-5.6.2-1.3.x86_64/build/kdevplatform/interfaces/KDevPlatformInterfaces_autogen/EWIEGA46WW/moc_idocumentcontroller.cpp:416
#38 0x00007fa14d743f0b in KDevelop::MainWindowPrivate::changeActiveView (this=0x5587260f00f0, view=0x558728ac75a0) at /usr/src/debug/kdevelop5-5.6.2-1.3.x86_64/kdevplatform/shell/mainwindow_p.cpp:158
#39 0x00007fa14be3a946 in QtPrivate::QSlotObjectBase::call (a=0x7fffce03d2e0, r=0x5587260f00f0, this=0x5587278f1b50) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#40 doActivate<false> (sender=0x5587260056d0, signal_index=12, argv=argv@entry=0x7fffce03d2e0) at kernel/qobject.cpp:3886
#41 0x00007fa14be33c60 in QMetaObject::activate (sender=sender@entry=0x5587260056d0, m=<optimized out>, local_signal_index=local_signal_index@entry=2, argv=argv@entry=0x7fffce03d2e0) at kernel/qobject.cpp:3946
#42 0x00007fa14a3fb902 in Sublime::MainWindow::activeViewChanged (this=this@entry=0x5587260056d0, _t1=<optimized out>, _t1@entry=0x558728ac75a0) at /usr/src/debug/kdevelop5-5.6.2-1.3.x86_64/build/kdevplatform/sublime/KDevPlatformSublime_autogen/include/moc_mainwindow.cpp:282
#43 0x00007fa14a3fdde2 in Sublime::MainWindow::setActiveView (this=this@entry=0x5587260056d0, view=view@entry=0x558728ac75a0, focus=focus@entry=true) at /usr/src/debug/kdevelop5-5.6.2-1.3.x86_64/kdevplatform/sublime/mainwindow.cpp:239
#44 0x00007fa14a3fee53 in Sublime::MainWindow::activateView (this=0x5587260056d0, view=0x558728ac75a0, focus=<optimized out>) at /usr/src/debug/kdevelop5-5.6.2-1.3.x86_64/kdevplatform/sublime/mainwindow.cpp:223
#45 0x00007fa14a3fa408 in Sublime::Controller::eventFilter (this=0x558726056710, obj=<optimized out>, ev=<optimized out>) at /usr/src/debug/kdevelop5-5.6.2-1.3.x86_64/kdevplatform/sublime/controller.cpp:387
#46 0x00007fa14be03f66 in QCoreApplicationPrivate::sendThroughApplicationEventFilters (event=<optimized out>, receiver=<optimized out>, this=<optimized out>) at kernel/qcoreapplication.cpp:1171
#47 QCoreApplicationPrivate::sendThroughApplicationEventFilters (this=this@entry=0x558725c3bde0, receiver=receiver@entry=0x558725fc7230, event=event@entry=0x7fffce03d4e0) at kernel/qcoreapplication.cpp:1156
#48 0x00007fa14cb82538 in QApplicationPrivate::notify_helper (this=0x558725c3bde0, receiver=0x558725fc7230, e=0x7fffce03d4e0) at kernel/qapplication.cpp:3603
#49 0x00007fa14be0432a in QCoreApplication::notifyInternal2 (receiver=0x558725fc7230, event=0x7fffce03d4e0) at kernel/qcoreapplication.cpp:1063
#50 0x00007fa14cb86271 in QApplicationPrivate::setFocusWidget (reason=<optimized out>, focus=<optimized out>) at kernel/qapplication.cpp:1722
#51 QApplicationPrivate::setFocusWidget (focus=focus@entry=0x558725fc7230, reason=reason@entry=Qt::OtherFocusReason) at kernel/qapplication.cpp:1676
#52 0x00007fa14cbbc286 in QWidget::setFocus (reason=Qt::OtherFocusReason, this=<optimized out>) at kernel/qwidget.cpp:6337
#53 QWidget::setFocus (this=this@entry=0x558725fc7230, reason=reason@entry=Qt::OtherFocusReason) at kernel/qwidget.cpp:6284
#54 0x00007fa14cba751c in QWidget::setFocus (this=0x558725fc7230) at ../../include/QtWidgets/../../src/widgets/kernel/qwidget.h:420
#55 QStackedLayout::setCurrentIndex (this=0x55872afc8dd0, index=4) at kernel/qstackedlayout.cpp:330
#56 0x00007fa14cba77ae in QStackedLayout::setCurrentWidget (this=<optimized out>, widget=widget@entry=0x558728962e90) at kernel/qstackedlayout.cpp:376
#57 0x00007fa14cd2b08b in QStackedWidget::setCurrentWidget (this=<optimized out>, widget=widget@entry=0x558728962e90) at widgets/qstackedwidget.cpp:248
#58 0x00007fa14a3f922e in Sublime::Container::setCurrentWidget (this=0x55872afc5db0, w=0x558728962e90) at /usr/src/debug/kdevelop5-5.6.2-1.3.x86_64/kdevplatform/sublime/container.cpp:546
#59 0x00007fa14a3fee44 in Sublime::MainWindow::activateView (this=0x5587260056d0, view=0x558728ac75a0, focus=<optimized out>) at /usr/src/debug/kdevelop5-5.6.2-1.3.x86_64/kdevplatform/sublime/mainwindow.cpp:221
#60 0x00007fa14be3a946 in QtPrivate::QSlotObjectBase::call (a=0x7fffce03d780, r=0x5587260056d0, this=0x55872afcce60) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#61 doActivate<false> (sender=0x55872afc5db0, signal_index=7, argv=argv@entry=0x7fffce03d780) at kernel/qobject.cpp:3886
#62 0x00007fa14be33c60 in QMetaObject::activate (sender=<optimized out>, m=m@entry=0x7fa14a424a00 <Sublime::Container::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7fffce03d780) at kernel/qobject.cpp:3946
#63 0x00007fa14a3ea62f in Sublime::Container::activateView (this=<optimized out>, _t1=<optimized out>) at /usr/src/debug/kdevelop5-5.6.2-1.3.x86_64/build/kdevplatform/sublime/KDevPlatformSublime_autogen/EWIEGA46WW/moc_container.cpp:268
#64 0x00007fa14be3a946 in QtPrivate::QSlotObjectBase::call (a=0x7fffce03d8a0, r=0x55872afc5db0, this=0x55872afc8f20) at ../../include/QtCore/../../src/corelib/kernel/qobjectdefs_impl.h:398
#65 doActivate<false> (sender=0x55872afc7000, signal_index=7, argv=argv@entry=0x7fffce03d8a0) at kernel/qobject.cpp:3886
#66 0x00007fa14be33c60 in QMetaObject::activate (sender=<optimized out>, m=m@entry=0x7fa14d08a320 <QTabBar::staticMetaObject>, local_signal_index=local_signal_index@entry=0, argv=argv@entry=0x7fffce03d8a0) at kernel/qobject.cpp:3946
#67 0x00007fa14cd2d45e in QTabBar::currentChanged (this=<optimized out>, _t1=<optimized out>) at .moc/moc_qtabbar.cpp:338
#68 0x00007fa14cd314b4 in QTabBar::setCurrentIndex (this=<optimized out>, index=<optimized out>) at widgets/qtabbar.cpp:1450
#69 0x00007fa14cd33a95 in QTabBar::mousePressEvent (this=0x55872afc7000, event=0x7fffce03de70) at widgets/qtabbar.cpp:2116
#70 0x00007fa14cbc234e in QWidget::event (this=0x55872afc7000, event=0x7fffce03de70) at kernel/qwidget.cpp:9019
#71 0x00007fa14cb824ff in QApplicationPrivate::notify_helper (this=this@entry=0x558725c3bde0, receiver=receiver@entry=0x55872afc7000, e=e@entry=0x7fffce03de70) at kernel/qapplication.cpp:3632
#72 0x00007fa14cb893eb in QApplication::notify (this=0x7fffce03db70, receiver=0x55872afc7000, e=0x7fffce03de70) at kernel/qapplication.cpp:3076
#73 0x00007fa14be0432a in QCoreApplication::notifyInternal2 (receiver=0x55872afc7000, event=0x7fffce03de70) at kernel/qcoreapplication.cpp:1063
#74 0x00007fa14cb88416 in QApplicationPrivate::sendMouseEvent (receiver=receiver@entry=0x55872afc7000, event=event@entry=0x7fffce03de70, alienWidget=alienWidget@entry=0x55872afc7000, nativeWidget=0x5587260056d0, buttonDown=buttonDown@entry=0x7fa14d0b0670 <qt_button_down>, lastMouseReceiver=..., spontaneous=true, onlyDispatchEnterLeave=false) at kernel/qapplication.cpp:2614
#75 0x00007fa14cbda3b1 in QWidgetWindow::handleMouseEvent (this=0x5587278712c0, event=0x7fffce03e130) at kernel/qwidgetwindow.cpp:683
#76 0x00007fa14cbdd8be in QWidgetWindow::event (this=0x5587278712c0, event=0x7fffce03e130) at kernel/qwidgetwindow.cpp:300
#77 0x00007fa14cb824ff in QApplicationPrivate::notify_helper (this=<optimized out>, receiver=0x5587278712c0, e=0x7fffce03e130) at kernel/qapplication.cpp:3632
#78 0x00007fa14be0432a in QCoreApplication::notifyInternal2 (receiver=0x5587278712c0, event=0x7fffce03e130) at kernel/qcoreapplication.cpp:1063
#79 0x00007fa14c354d03 in QGuiApplicationPrivate::processMouseEvent (e=0x55872cb8af30) at kernel/qguiapplication.cpp:2282
#80 0x00007fa14c32ac5c in QWindowSystemInterface::sendWindowSystemEvents (flags=flags@entry=...) at kernel/qwindowsysteminterface.cpp:1169
#81 0x00007fa137a88faa in xcbSourceDispatch (source=source@entry=0x558725d31c40) at qxcbeventdispatcher.cpp:105
#82 0x00007fa14847ff57 in g_main_dispatch (context=0x7fa130005000) at ../glib/gmain.c:3325
#83 g_main_context_dispatch (context=0x7fa130005000) at ../glib/gmain.c:4043
#84 0x00007fa1484802d8 in g_main_context_iterate (context=context@entry=0x7fa130005000, block=block@entry=1, dispatch=dispatch@entry=1, self=<optimized out>) at ../glib/gmain.c:4119
#85 0x00007fa14848038f in g_main_context_iteration (context=0x7fa130005000, may_block=may_block@entry=1) at ../glib/gmain.c:4184
#86 0x00007fa14be5b8bf in QEventDispatcherGlib::processEvents (this=0x558725d2b180, flags=...) at kernel/qeventdispatcher_glib.cpp:423
#87 0x00007fa14be02ceb in QEventLoop::exec (this=this@entry=0x7fffce03e460, flags=..., flags@entry=...) at ../../include/QtCore/../../src/corelib/global/qflags.h:69
#88 0x00007fa14be0af60 in QCoreApplication::exec () at ../../include/QtCore/../../src/corelib/global/qflags.h:121
#89 0x00007fa14c34835c in QGuiApplication::exec () at kernel/qguiapplication.cpp:1867
#90 0x00007fa14cb82475 in QApplication::exec () at kernel/qapplication.cpp:2824
#91 0x00005587246db6e6 in main (argc=<optimized out>, argv=<optimized out>) at /usr/src/debug/kdevelop5-5.6.2-1.3.x86_64/app/main.cpp:850
[Inferior 1 (process 8973) detached]

Possible duplicates by query: bug 53904, bug 218425, bug 203904, bug 183966, bug 135473.

Reported using DrKonqi
Comment 1 Sven Brauch 2021-04-11 22:57:01 UTC
This doesn't look related to kdev-python or kdevelop, I'm moving it to KTextEditor.
Comment 2 Christoph Cullmann 2022-01-08 16:33:10 UTC
I would like to fix this, but without a proper way to reproduce this, I can't see how I can :(
Comment 3 Jaime Torres 2022-01-08 17:11:46 UTC
Created attachment 145233 [details]
Folding gone crazy
Comment 4 Jaime Torres 2022-01-08 17:12:16 UTC
I've seen how to reproduce it.
Create a trivial python program, for example:

class Test:
    # line added

    def __init__(self):
        a = '''
            Some text
        '''

    def test(self):
        # line added

        # line added
        for i in range(10):
            print('hello world')

            with open('test.py') as f:
                lines = f.read()

fold it in the for loop
save the session and close kate
modify the file with another editor and insert one blank line where there was already one:

class Test:
    # line added


    def __init__(self):
        a = '''
            Some text
        '''


    def test(self):
        # line added


        # line added
        for i in range(10):
            print('hello world')


            with open('test.py') as f:
                lines = f.read()

Open kate and the folding is gone crazy (like in the attached screenshot). But can not easily reproduce the crash.
Comment 5 Christoph Cullmann 2022-01-08 20:26:59 UTC
The the folding does strange stuff after the file was externally modified on restore of the session is clear, it will just restore the ranges in some best effort way, that will not work.
But it should not crash and one should be able to unfold the stuff, that works, doesn't it?
Comment 6 Jaime Torres 2022-01-09 07:49:48 UTC
> But it should not crash and one should be able to unfold the stuff, that works, doesn't it?
Unfortunately is not what I can see with the little file (and bigger ones)..
When I try to unfold the for loop, it folds the method definition and if I unfold the method, the for loop is still folded. Folding and unfolding other parts doesn't help also. I can only see the for loop in the preview of the folded method.
Comment 7 Waqar Ahmed 2022-08-11 05:46:34 UTC
This has been fixed now in the way that Foldings are not restored if the document isn't exactly the same.