Summary: | [unit test] kate crashes if cursor is inside folded code block and up key is pressed | ||
---|---|---|---|
Product: | [Applications] kate | Reporter: | uran238 |
Component: | folding | Assignee: | KWrite Developers <kwrite-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | crash | CC: | adrian.lungu89, bill-auger, Chris, christoph, egonpin, eric_moyer, kde.kfoar, kde, kdebugs.andromodon, neutrino0311 |
Priority: | NOR | Keywords: | testcase |
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | http://commits.kde.org/kate/5888f4b7020115f9bf9b55ff12d33e212d4258f4 | Version Fixed In: | 4.11 |
Sentry Crash Report: | |||
Attachments: |
simpe source exposing the bug
New crash information added by DrKonqi possible fix correct patch this time |
Description
uran238
2012-12-18 08:02:54 UTC
Created attachment 76126 [details]
simpe source exposing the bug
place cursor at line 4, fold (with hotkey!), press up, crash
Git commit 2086aa205ab3d9450aa2a509894e5b9239cceb50 by Dominik Haumann. Committed on 06/01/2013 at 13:22. Pushed by dhaumann into branch 'master'. add unit test for crash in code folding (bug311866) todo: make sure the cursor position is valid (in visible text area) if the code folding changes. This fix should not be done in KateViewInternal::regionVisibilityChanged() as then we run into selection bugs like e.g. http://bugs.kde.org/show_bug.cgi?id=295632 bug tracker: http://bugs.kde.org/show_bug.cgi?id=311866 A +5 -0 part/tests/bug311866.cpp [License: UNKNOWN] * M +38 -0 part/tests/katefolding_test.cpp M +5 -4 part/tests/katefolding_test.h The files marked with a * at the end have a non valid license. Please read: http://techbase.kde.org/Policies/Licensing_Policy and use the headers which are listed at that page. http://commits.kde.org/kate/2086aa205ab3d9450aa2a509894e5b9239cceb50 *** Bug 313628 has been marked as a duplicate of this bug. *** *** Bug 314245 has been marked as a duplicate of this bug. *** Created attachment 77479 [details]
New crash information added by DrKonqi
kwrite (4.9.4) on KDE Platform 4.9.4 using Qt 4.8.3
- What I was doing when the application crashed:
just folded code blocks, and then started scrolling up or down (I don't remember).
-- Backtrace (Reduced):
#6 KateLineLayout::viewLineCount (this=0x0) at ../../part/render/katelinelayout.cpp:173
#7 0x00007fa1904b8cfb in KateLayoutCache::lastViewLine (this=0x0, this@entry=0x24a0d40, realLine=38407488) at ../../part/render/katelayoutcache.cpp:461
#8 0x00007fa1904b8d49 in KateLayoutCache::viewLineCount (this=this@entry=0x24a0d40, realLine=<optimized out>) at ../../part/render/katelayoutcache.cpp:466
#9 0x00007fa1904b93e4 in KateLayoutCache::displayViewLine (this=0x24a0d40, virtualCursor=..., limitToVisible=<optimized out>) at ../../part/render/katelayoutcache.cpp:429
#10 0x00007fa19050af0a in KateViewInternal::pageDown (this=0x2498450, sel=<optimized out>, half=<optimized out>) at ../../part/view/kateviewinternal.cpp:1572
@Christoph: Still reproducible. To be checked with new code folding, so best adapt the test to at least test once before deleting the test. *** Bug 317235 has been marked as a duplicate of this bug. *** Uhg, I deleted that test now I guess :( If you want to adapt it to the new folding, plz recover it from commit 1e7df474b9d5d69e80428736176cbf22e81c2649 It may make sense since the crash is in the KateLayoueCache. So if this bug was due to other bogus code unrelated to code folding, it makes sense to check this once. Backtrace with new folding: [KCrash Handler] #6 0xb77a6424 in __kernel_vsyscall () #7 0xb57b831f in raise () from /lib/libc.so.6 #8 0xb57b9c03 in abort () from /lib/libc.so.6 #9 0xb5b65e5e in qt_message_output (msgType=QtFatalMsg, buf=0x884a670 "ASSERT: \"d\" in file /usr/include/ksharedptr.h, line 126") at global/qglobal.cpp:2323 #10 0xb5b66059 in qt_message (msgType=QtFatalMsg, msg=0xb5cefc54 "ASSERT: \"%s\" in file %s, line %d", ap=0xbfe498e4 "\025\337>\263\220\337>\263~") at global/qglobal.cpp:2369 #11 0xb5b66178 in qFatal (msg=msg@entry=0xb5cefc54 "ASSERT: \"%s\" in file %s, line %d") at global/qglobal.cpp:2552 #12 0xb5b661f5 in qt_assert (assertion=0xb33edf15 "d", file=0xb33edf90 "/usr/include/ksharedptr.h", line=126) at global/qglobal.cpp:2018 #13 0xb32b1b85 in KSharedPtr<KateLineLayout>::operator-> (this=0xbfe4993c) at /usr/include/ksharedptr.h:126 #14 0xb32b5deb in KateLayoutCache::textLayout (this=0x8a49758, realLine=5, _viewLine=-1) at /home/dh/kde/kate/part/render/katelayoutcache.cpp:355 #15 0xb33077ee in KateViewInternal::previousLayout (this=0x8a69a48) at /home/dh/kde/kate/part/view/kateviewinternal.cpp:1247 #16 0xb330855e in KateViewInternal::cursorUp (this=0x8a69a48, sel=false) at /home/dh/kde/kate/part/view/kateviewinternal.cpp:1415 #17 0xb32fe779 in KateView::up (this=0x897c850) at /home/dh/kde/kate/part/view/kateview.cpp:2610 Git commit 0d78fa1eed528a4e918552b08f171f243925bb1b by Dominik Haumann. Committed on 12/04/2013 at 00:18. Pushed by dhaumann into branch 'master'. add folding test again This test still crashes: The cursor is hidden in a folding region. Moving the cursor crashes Kate. M +11 -0 tests/CMakeLists.txt A +5 -0 tests/data/bug311866.cpp [License: UNKNOWN] * A +79 -0 tests/katefoldingtest.cpp [License: LGPL (v2+)] A +37 -0 tests/katefoldingtest.h [License: LGPL (v2+)] The files marked with a * at the end have a non valid license. Please read: http://techbase.kde.org/Policies/Licensing_Policy and use the headers which are listed at that page. http://commits.kde.org/kate/0d78fa1eed528a4e918552b08f171f243925bb1b > A +5 -0 tests/data/bug311866.cpp [License: UNKNOWN] *
You can put that example under any license you want.
Created attachment 78960 [details]
possible fix
Make sure the cursor is at a valid text position after folding text.
Created attachment 78961 [details]
correct patch this time
move cursor if it is in a folded region.
Git commit 5888f4b7020115f9bf9b55ff12d33e212d4258f4 by Dominik Haumann. Committed on 16/04/2013 at 15:29. Pushed by dhaumann into branch 'master'. make sure cursor stays visible/valid when text is folded FIXED-IN: 4.11 Related: bug 200858 M +9 -0 part/buffer/katetextfolding.cpp M +11 -1 part/buffer/katetextfolding.h M +9 -7 part/view/kateviewinternal.cpp http://commits.kde.org/kate/5888f4b7020115f9bf9b55ff12d33e212d4258f4 *** Bug 324146 has been marked as a duplicate of this bug. *** *** Bug 324468 has been marked as a duplicate of this bug. *** *** Bug 325133 has been marked as a duplicate of this bug. *** Application: kate (3.13.3) KDE Platform Version: 4.13.3 Qt Version: 4.8.6 Operating System: Linux 3.13.0-45-generic i686 Distribution: Trisquel GNU/Linux 7.0, Belenos -- Information about the crash: - duplicate symptom as bug #311866 which is marked as resolved and closed as of 4.11 (oct 2013) - unfortunately at least on my platform the bug is still present (fresh install of trisquel) -- What I was doing when the application crashed: STEPS: - fold or fold-all via keybinding - move text cursor over folded zone via arrow keys - crash NOTE: crash can generally be avoided by pressing PGUP/PGDN immediately after folding SYSTEM: kate: 3.13.3 (4:4.13.3-0ubuntu0.1 from trisquel belenos-updates repo) kde-runtime: 4.13.3 (4:4.13.3-0ubuntu0.2+kxstudio1 from kxstudio trusty repo) os: trisquel 7.0 de: lxde -- Additional notes: this bug has existed for many years on both nix and windows this is my first time reporting but it occurs very often kate is my fav editor and this is the only grief that she has ever given me so i would be happy to help any way i can to fix this for good the crash handler/bug reporting GUI did not work for me login timed out apparently but then the "back" button was disabled the following is the backtrace it created: The crash can be reproduced sometimes. -- Backtrace: Application: Kate (kate), signal: Segmentation fault Using host libthread_db library "/lib/i386-linux-gnu/libthread_db.so.1". [Current thread is 1 (Thread 0xb4d53740 (LWP 4719))] Thread 4 (Thread 0xb0165b40 (LWP 4748)): #0 0xb7764424 in __kernel_vsyscall () #1 0xb5efed4b in pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/i386/i686/../i486/pthread_cond_wait.S:187 #2 0xb76876ec in __pthread_cond_wait (cond=0xb05fc8d0, mutex=0xb05fc8b8) at forward.c:149 #3 0xb04f9c92 in ?? () from /usr/lib/i386-linux-gnu/libQtScript.so.4 #4 0xb04f9cdf in ?? () from /usr/lib/i386-linux-gnu/libQtScript.so.4 #5 0xb5efaf70 in start_thread (arg=0xb0165b40) at pthread_create.c:312 #6 0xb767a50e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:129 Thread 3 (Thread 0xa259bb40 (LWP 4751)): #0 0xb5e58d0e in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0 #1 0xb5e59118 in g_mutex_unlock () from /lib/i386-linux-gnu/libglib-2.0.so.0 #2 0xb5e13515 in g_main_context_release () from /lib/i386-linux-gnu/libglib-2.0.so.0 #3 0xb5e14390 in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0 #4 0xb5e1476b in g_main_loop_run () from /lib/i386-linux-gnu/libglib-2.0.so.0 #5 0xb29d036a in ?? () from /usr/lib/i386-linux-gnu/libgio-2.0.so.0 #6 0xb5e3a9aa in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0 #7 0xb5efaf70 in start_thread (arg=0xa259bb40) at pthread_create.c:312 #8 0xb767a50e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:129 Thread 2 (Thread 0xa1a6bb40 (LWP 4792)): #0 0xb7764424 in __kernel_vsyscall () #1 0xb7688192 in __GI___clock_gettime (clock_id=1, tp=0xa1a6aff8) at ../sysdeps/unix/clock_gettime.c:115 #2 0xb60f58cc in do_gettime (frac=0xa1a6aff0, sec=0xa1a6afe8) at tools/qelapsedtimer_unix.cpp:127 #3 qt_gettime () at tools/qelapsedtimer_unix.cpp:144 #4 0xb61de2a2 in updateCurrentTime (this=0x866bf7c) at kernel/qeventdispatcher_unix.cpp:354 #5 QTimerInfoList::timerWait (this=0x866bf7c, tm=...) at kernel/qeventdispatcher_unix.cpp:460 #6 0xb61dc82b in timerSourcePrepareHelper (src=<optimized out>, timeout=0xa1a6b0ec) at kernel/qeventdispatcher_glib.cpp:143 #7 0xb61dc8bd in timerSourcePrepare (source=0x866bf48, timeout=0xa1a6b0ec) at kernel/qeventdispatcher_glib.cpp:176 #8 0xb5e139b3 in g_main_context_prepare () from /lib/i386-linux-gnu/libglib-2.0.so.0 #9 0xb5e142df in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0 #10 0xb5e14528 in g_main_context_iteration () from /lib/i386-linux-gnu/libglib-2.0.so.0 #11 0xb61dc95f in QEventDispatcherGlib::processEvents (this=0x866b560, flags=...) at kernel/qeventdispatcher_glib.cpp:436 #12 0xb61ab823 in QEventLoop::processEvents (this=this@entry=0xa1a6b258, flags=...) at kernel/qeventloop.cpp:149 #13 0xb61abb49 in QEventLoop::exec (this=this@entry=0xa1a6b258, flags=...) at kernel/qeventloop.cpp:204 #14 0xb609823d in QThread::exec (this=this@entry=0x8669ee8) at thread/qthread.cpp:537 #15 0xb618bc44 in QInotifyFileSystemWatcherEngine::run (this=0x8669ee8) at io/qfilesystemwatcher_inotify.cpp:265 #16 0xb609ab6f in QThreadPrivate::start (arg=0x8669ee8) at thread/qthread_unix.cpp:349 #17 0xb5efaf70 in start_thread (arg=0xa1a6bb40) at pthread_create.c:312 #18 0xb767a50e in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:129 Thread 1 (Thread 0xb4d53740 (LWP 4719)): [KCrash Handler] #7 viewLineCount (this=0x0) at ../../part/render/katelinelayout.cpp:174 #8 KateLineLayout::viewLine (this=0x0, viewLine=viewLine@entry=-1) at ../../part/render/katelinelayout.cpp:180 #9 0xb075cc61 in KateLayoutCache::textLayout (this=0xd969320, realLine=414, _viewLine=-1) at ../../part/render/katelayoutcache.cpp:355 #10 0xb07aa713 in KateViewInternal::previousLayout (this=this@entry=0x8d434f0) at ../../part/view/kateviewinternal.cpp:1278 #11 0xb07b14db in KateViewInternal::cursorUp (this=0x8d434f0, sel=sel@entry=false) at ../../part/view/kateviewinternal.cpp:1446 #12 0xb0792519 in KateView::up (this=0x8c02aa8) at ../../part/view/kateview.cpp:2668 #13 0xb07a44ad in KateView::qt_static_metacall (_o=0x0, _id=-1332734644, _a=0xbf87d488, _c=<optimized out>) at ./kateview.moc:353 #14 0xb61c20f7 in QMetaObject::activate (sender=sender@entry=0xd915f68, m=m@entry=0xb756c718 <QAction::staticMetaObject>, local_signal_index=local_signal_index@entry=1, argv=argv@entry=0xbf87d488) at kernel/qobject.cpp:3539 #15 0xb6c0b72d in QAction::triggered (this=this@entry=0xd915f68, _t1=false) at .moc/release-shared/moc_qaction.cpp:276 #16 0xb6c0d324 in QAction::activate (this=this@entry=0xd915f68, event=event@entry=QAction::Trigger) at kernel/qaction.cpp:1257 #17 0xb6c0d4b0 in QAction::event (this=this@entry=0xd915f68, e=e@entry=0xbf87d7c8) at kernel/qaction.cpp:1183 #18 0xb64806fd in KAction::event (this=0xd915f68, event=0xbf87d7c8) at ../../kdeui/actions/kaction.cpp:131 #19 0xb6c127f4 in QApplicationPrivate::notify_helper (this=0x8090c10, receiver=0xd915f68, e=0xbf87d7c8) at kernel/qapplication.cpp:4567 #20 0xb6c192d3 in QApplication::notify (this=0xbf87e23c, receiver=receiver@entry=0xd915f68, e=e@entry=0xbf87d7c8) at kernel/qapplication.cpp:4353 #21 0xb656f1f4 in KApplication::notify (this=0xbf87e23c, receiver=0xd915f68, event=0xbf87d7c8) at ../../kdeui/kernel/kapplication.cpp:311 #22 0xb61ace4a in QCoreApplication::notifyInternal (this=0xbf87e23c, receiver=0xd915f68, event=event@entry=0xbf87d7c8) at kernel/qcoreapplication.cpp:953 #23 0xb6c4a8bb in sendEvent (event=0xbf87d7c8, receiver=<optimized out>) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231 #24 QShortcutMap::dispatchEvent (this=this@entry=0x8090cbc, e=e@entry=0xbf87dac8) at kernel/qshortcutmap.cpp:887 #25 0xb6c4aa3d in QShortcutMap::tryShortcutEvent (this=0x8090cbc, o=0x8d434f0, e=0xbf87dac8) at kernel/qshortcutmap.cpp:367 #26 0xb6c1aca8 in QApplication::notify (this=0xbf87e23c, receiver=receiver@entry=0x8d434f0, e=e@entry=0xbf87dac8) at kernel/qapplication.cpp:3991 #27 0xb656f1f4 in KApplication::notify (this=0xbf87e23c, receiver=0x8d434f0, event=0xbf87dac8) at ../../kdeui/kernel/kapplication.cpp:311 #28 0xb61ace4a in QCoreApplication::notifyInternal (this=0xbf87e23c, receiver=receiver@entry=0x8d434f0, event=event@entry=0xbf87dac8) at kernel/qcoreapplication.cpp:953 #29 0xb6c10c7d in sendSpontaneousEvent (event=0xbf87dac8, receiver=0x8d434f0) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:234 #30 qt_sendSpontaneousEvent (receiver=0x8d434f0, event=event@entry=0xbf87dac8) at kernel/qapplication.cpp:5565 #31 0xb6cc4829 in QKeyMapper::sendKeyEvent (keyWidget=keyWidget@entry=0x8d434f0, grab=grab@entry=false, type=QEvent::KeyPress, code=16777235, modifiers=..., text=..., autorepeat=autorepeat@entry=false, count=1, nativeScanCode=nativeScanCode@entry=111, nativeVirtualKey=65362, nativeModifiers=nativeModifiers@entry=0) at kernel/qkeymapper_x11.cpp:1866 #32 0xb6cc4c18 in QKeyMapperPrivate::translateKeyEvent (this=0x80c0e08, keyWidget=keyWidget@entry=0x8d434f0, event=event@entry=0xbf87de3c, grab=grab@entry=false) at kernel/qkeymapper_x11.cpp:1836 #33 0xb6c9ada5 in QApplication::x11ProcessEvent (this=0xbf87e23c, event=event@entry=0xbf87de3c) at kernel/qapplication_x11.cpp:3642 #34 0xb6cc7524 in x11EventSourceDispatch (s=0x808f4a8, callback=0x0, user_data=0x0) at kernel/qguieventdispatcher_glib.cpp:146 #35 0xb5e141e3 in g_main_context_dispatch () from /lib/i386-linux-gnu/libglib-2.0.so.0 #36 0xb5e14468 in ?? () from /lib/i386-linux-gnu/libglib-2.0.so.0 #37 0xb5e14528 in g_main_context_iteration () from /lib/i386-linux-gnu/libglib-2.0.so.0 #38 0xb61dc93b in QEventDispatcherGlib::processEvents (this=this@entry=0x805fef0, flags=...) at kernel/qeventdispatcher_glib.cpp:434 #39 0xb6cc75de in QGuiEventDispatcherGlib::processEvents (this=0x805fef0, flags=...) at kernel/qguieventdispatcher_glib.cpp:204 #40 0xb61ab823 in QEventLoop::processEvents (this=this@entry=0xbf87e0f8, flags=...) at kernel/qeventloop.cpp:149 #41 0xb61abb49 in QEventLoop::exec (this=this@entry=0xbf87e0f8, flags=...) at kernel/qeventloop.cpp:204 #42 0xb61b18fe in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1225 #43 0xb6c10a24 in QApplication::exec () at kernel/qapplication.cpp:3828 #44 0xb775d92d in kdemain (argc=2, argv=0xbf87e344) at ../../../kate/app/katemain.cpp:381 #45 0x0804854b in main (argc=2, argv=0xbf87e344) at kate_dummy.cpp:3 Possible duplicates by query: bug 341129, bug 330221, bug 327174, bug 325133, bug 324468. just thought to add that the cursor need not necessarily be inside a folded code block in order to reproduce as indicated in the title of this issue - i normally move cursor to last char of the file before fold-all and still is likely to crash if i forget to press PGUP after folding - the cursor often disappears just after folding |