Summary: | crash (assert failure) doing undo+redo | ||
---|---|---|---|
Product: | [Applications] kate | Reporter: | Matthew Woehlke <mwoehlke.floss> |
Component: | kwrite | Assignee: | KWrite Developers <kwrite-bugs-null> |
Status: | RESOLVED FIXED | ||
Severity: | crash | CC: | andresbajotierra, ultimate.sephiroth |
Priority: | VHI | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | Compiled Sources | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: | kate-undo-redo-fix.patch |
Description
Matthew Woehlke
2008-05-24 02:55:51 UTC
Yes, this one is a very urgent bug. The current solution still does not always set the cursor correctly. Would really be goot to have a fix for 4.1, at least for the crashes. Agree, this is something that needs to be fixed asap, I hoped someone else was interested in debugging it...? I guess people might be looking in my direction, but to be honest, I can't think that I've been bit by this in a while. Not sure about the cursor, but maybe the crashing got fixed somewhere along the line? no, it has nothing to do with your commits. It's about trying to make undo/redo always set the cursor position correct. But I don't see a solution right now. At least a fix to not make it crash should be committed, I'll try to look into this, hm... Can you try the attached patch please? Changes include - the undo cursor and undo selection are saved with the first KateDocument::editStart() - the redo cursor and redo selection are saved with the last KateDocument::editEnd() For this to work, the following parts needed to be fixed - wrap doDeleteWordLeft/Right with editStart() and editEnd(), otherwise wordLeft() and wordRight() change the cursor position - drag & drop: while moving the cursor position is changed. To make it work, we need to fix the cursor position before we really do the drop operation. The undo selection is only set in the case of a move, otherwise it does not make sense (it feels really strange) Please test the patch, as it should go into KDE 4.1 if it works. Right now, the KDE 4.1 branch crashes sometimes when doing undo/redo. Thanks! -Dominik Created an attachment (id=26084) kate-undo-redo-fix.patch I could apply it, but I'm not able to reproduce the crash reliably (actually, haven't seen it for a while), so I can't really tell you if it works :-). Any pointers how to tickle the bug? I used to reproduce it with inserting several lines, select all, join lines, type text, undo, undo, undo, redo, ... play around with it, ... and then at some point: crash :) This patch is of course about fixing the crash. But it's even more about getting the cursor position right for undo, for redo. and also for selection. for copy&paste, etc... if it works good enough (i.e. no crash and sane positions, it should be committed). For me it was paste text on one line so the cursor is at the end of the line, then undo the paste, cursor stays -> crash. Ok, I can reliably produce a crash (same assert, but different bt) as follows (based on Dominik's method): - open my .bashrc (probably any file ~30-100 lines will do) - paste a few lines somewhere - select all, join - type a few things randomly (this step may be unnecessary) - undo to on-disk state, i.e. as much as possible - redo x2 -> BANG! I'll try to test the patch tomorrow. (yes, the mail on kwrite-devel is about this bug http://permalink.gmane.org/gmane.comp.kde.devel.kwrite/16946) In that case I'll repost here for the record: with the patch, the procedure in comment #9 no longer results in a crash. SVN commit 833482 by dhaumann: Changes include - the undo cursor and undo selection are saved with the first KateDocument::editStart() - the redo cursor and redo selection are saved with the last KateDocument::editEnd() For this to work, the following parts needed to be fixed - wrap doDeleteWordLeft/Right with editStart() and editEnd(), otherwise wordLeft() and wordRight() change the cursor position - drag & drop: while moving the cursor position is changed. To make it work, we need to fix the cursor position before we really do the drop operation. The undo selection is only set in the case of a move, otherwise it does not make sense (it feels really strange) Please test the patch, as it should go into KDE 4.1 if it works. Right now, the KDE 4.1 branch crashes sometimes when doing undo/redo. Port to KDE 4.1.0? Wait for KDE 4.1.1? dunno... CCBUG: 162546 M +9 -5 document/katedocument.cpp M +34 -16 document/kateundo.cpp M +28 -6 document/kateundo.h M +27 -14 view/kateviewinternal.cpp WebSVN link: http://websvn.kde.org/?view=rev&revision=833482 Here using: Qt: 4.4.3 KDE: 4.1.85 (KDE 4.1.85 (KDE 4.2 Beta2)) kdelibs svn rev. 899135 / kdebase svn rev. 899135 kdesdk svn rev.897359 on ArchLinux x86_64 - Kernel 2.6.27.8 I can't reproduce the crash even following the steps described in comment 9. Any news on this? Have anyone experienced this again ? I think I just happened to come across this crash, though I used Kate and when I tried to redo, it wasn't the most recent one. Kate version: 3.1.3, bundled with KDE 4.1 installed from the Intrepid Ibex Kubuntu CD. My backtrace (I think I can't reproduce it to get the required dbg packages): Ohjelma: Kate (kate), signaali SIGABRT (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) (no debugging symbols found) [Thread debugging using libthread_db enabled] [New Thread 0xb5c82920 (LWP 9424)] [KCrash handler] #6 0xb7f09430 in __kernel_vsyscall () #7 0xb7d9a880 in raise () from /lib/tls/i686/cmov/libc.so.6 #8 0xb7d9c248 in abort () from /lib/tls/i686/cmov/libc.so.6 #9 0xb6ff3795 in qt_message_output () from /usr/lib/libQtCore.so.4 #10 0xb6ff3872 in qFatal () from /usr/lib/libQtCore.so.4 #11 0xb6ff3915 in qt_assert () from /usr/lib/libQtCore.so.4 #12 0xb430ddea in KateLayoutCache::viewLine (this=0xabbdca0, realCursor=@0xabc16e4) at /build/buildd/kde4libs-4.1.3/kdecore/util/ksharedptr.h:116 #13 0xb430e34c in KateLayoutCache::textLayout (this=0xabbdca0, realCursor=@0xabc16e4) at /build/buildd/kde4libs-4.1.3/kate/render/katelayoutcache.cpp:312 #14 0xb436b7c7 in KateViewInternal::updateCursor (this=0xabc1690, newCursor=@0xabc16e4, force=true, center=false, calledExternally=false) at /build/buildd/kde4libs-4.1.3/kate/view/kateviewinternal.cpp:1808 #15 0xb4371fc3 in KateViewInternal::editEnd (this=0xabc1690, editTagLineStart=8, editTagLineEnd=8, tagFrom=true) at /build/buildd/kde4libs-4.1.3/kate/view/kateviewinternal.cpp:3190 #16 0xb434edd9 in KateView::editEnd (this=0xabb7710, editTagLineStart=8, editTagLineEnd=8, tagFrom=<value optimized out>) at /build/buildd/kde4libs-4.1.3/kate/view/kateview.cpp:1333 #17 0xb42d3e09 in KateDocument::editEnd (this=0xabc4620) at /build/buildd/kde4libs-4.1.3/kate/document/katedocument.cpp:1102 #18 0xb42ee37c in KateUndoGroup::redo (this=0xac7ae68) at /build/buildd/kde4libs-4.1.3/kate/document/kateundo.cpp:292 #19 0xb42d0eb0 in KateDocument::redo (this=0xabc4620) at /build/buildd/kde4libs-4.1.3/kate/document/katedocument.cpp:1659 #20 0xb42d1676 in KateDocument::qt_metacall (this=0xabc4620, _c=QMetaObject::InvokeMetaMethod, _id=35, _a=0xbfb0740c) at /build/buildd/kde4libs-4.1.3/obj-i486-linux-gnu/kate/katedocument.moc:286 #21 0xb7100a60 in QMetaObject::activate () from /usr/lib/libQtCore.so.4 #22 0xb7100e60 in QMetaObject::activate () from /usr/lib/libQtCore.so.4 #23 0xb75205f1 in QAction::triggered () from /usr/lib/libQtGui.so.4 #24 0xb7520f5f in QAction::activate () from /usr/lib/libQtGui.so.4 #25 0xb75244bb in QAction::event () from /usr/lib/libQtGui.so.4 #26 0xb75839d9 in QWidgetAction::event () from /usr/lib/libQtGui.so.4 #27 0xb75268ec in QApplicationPrivate::notify_helper () from /usr/lib/libQtGui.so.4 #28 0xb752e72e in QApplication::notify () from /usr/lib/libQtGui.so.4 #29 0xb66bdb2d in KApplication::notify (this=0xbfb0870c, receiver=0xabd78c8, event=0xbfb07814) at /build/buildd/kde4libs-4.1.3/kdeui/kernel/kapplication.cpp:311 #30 0xb70ebe61 in QCoreApplication::notifyInternal () from /usr/lib/libQtCore.so.4 #31 0xb755f8e8 in ?? () from /usr/lib/libQtGui.so.4 #32 0xb75612bf in ?? () from /usr/lib/libQtGui.so.4 #33 0xb752f9f0 in QApplication::notify () from /usr/lib/libQtGui.so.4 #34 0xb66bdb2d in KApplication::notify (this=0xbfb0870c, receiver=0xabc1690, event=0xbfb07bac) at /build/buildd/kde4libs-4.1.3/kdeui/kernel/kapplication.cpp:311 #35 0xb70ebe61 in QCoreApplication::notifyInternal () from /usr/lib/libQtCore.so.4 #36 0xb75873de in ?? () from /usr/lib/libQtGui.so.4 #37 0xb75bdbb0 in ?? () from /usr/lib/libQtGui.so.4 #38 0xb75bfd26 in ?? () from /usr/lib/libQtGui.so.4 #39 0xb7596af5 in QApplication::x11ProcessEvent () from /usr/lib/libQtGui.so.4 #40 0xb75c17aa in ?? () from /usr/lib/libQtGui.so.4 #41 0xb63b66f8 in IA__g_main_context_dispatch (context=0x91edc98) at /build/buildd/glib2.0-2.18.2/glib/gmain.c:2144 #42 0xb63b9da3 in g_main_context_iterate (context=0x91edc98, block=1, dispatch=1, self=0x91eb610) at /build/buildd/glib2.0-2.18.2/glib/gmain.c:2778 #43 0xb63b9f61 in IA__g_main_context_iteration (context=0x91edc98, may_block=1) at /build/buildd/glib2.0-2.18.2/glib/gmain.c:2841 #44 0xb7116478 in QEventDispatcherGlib::processEvents () from /usr/lib/libQtCore.so.4 #45 0xb75c0ea5 in ?? () from /usr/lib/libQtGui.so.4 #46 0xb70ea52a in QEventLoop::processEvents () from /usr/lib/libQtCore.so.4 #47 0xb70ea6ea in QEventLoop::exec () from /usr/lib/libQtCore.so.4 #48 0xb70ecda5 in QCoreApplication::exec () from /usr/lib/libQtCore.so.4 #49 0xb7526767 in QApplication::exec () from /usr/lib/libQtGui.so.4 #50 0xb7ed17cd in kdemain () from /usr/lib/libkdeinit4_kate.so #51 0x080485a2 in _start () #0 0xb7f09430 in __kernel_vsyscall () I'm pretty sure I've fixed that for KDE 4.2. Please update as soon as possible to confirm this. Thanks. Close as fixed as the main problem in comment #1 doesn't appear anymore. If there is still a similar crash, please open a new report. |