Summary: | [patch] w + backspace crashes Konqueror if automatic text completion is enabled | ||
---|---|---|---|
Product: | [Unmaintained] kdelibs | Reporter: | Yngve Levinsen <yngve> |
Component: | general | Assignee: | kdelibs bugs <kdelibs-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | crash | CC: | faure, finex, frank78ac, joshua.rickmar |
Priority: | NOR | ||
Version: | 4.0 | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: |
Suggested patch
Improved patch Extended patch (trying to reduce the code complexity) |
Description
Yngve Levinsen
2008-06-02 23:35:58 UTC
you hit "w" and then "backspace"... ok, but where? on the address bar? If so, I cannot reproduce the crash using current trunk. Could you try a more recent version like 4.1-beta2? Thanks a lot Yngve! Yes, in the address bar. I suppose if you don't manage to reproduce the bug, then it is probably fixed. I will check with a more recent version as soon as I have the time (suppose I should always check more recent versions before I report a bug, sorry about that) Don't worry, I'll let this report open. Please do your tests and tell us if you can still reproduce the crash. Thanks a lot Yngve! :-) I have now tried again with KDE 4.0.83 (konqueror 4.00.83) and I am still reproducing the bug. This is a more or less clean install (I reinstalled kubuntu about a week ago). The bug also occurs when I hit "/". Any other output/information that could be useful for you? Step by step (remember to use automatic text completion, it seems the problem lies here as far as I can see): Open konqueror (focus is then in the address bar) Hit "w" or "/" Hit backspace *bang* :) Error message: A Fatal Error Occurred The application Konqueror (konqueror) crashed and caused the signal 6 (SIGABRT). Please help us improve... Confirmed on SVN trunk rev. 832974: Open Konqueror, right click on location bar, select "Text Completion/Automatic", then press w or /. A suggested completion appears in grey, and if I press backspace, I get a crash. I'll paste my backtrace which is more verbose than the one from the original report below. It's strange though that some functions from the origninal backtrace do not appear in mine. Application: Konqueror (konqueror), signal SIGABRT Thread 1 (Thread 0xb5e07720 (LWP 8159)): [KCrash Handler] #6 0xb7fa9410 in __kernel_vsyscall () #7 0xb6161085 in raise () from /lib/tls/i686/cmov/libc.so.6 #8 0xb6162a01 in abort () from /lib/tls/i686/cmov/libc.so.6 #9 0xb727d1d8 in qt_message_output (msgType=QtFatalMsg, buf=0xbfc17dd0 "ASSERT: \"i >= 0 && i < size()\" in file /home/kde-devel/qt-copy/include/QtCore/qstring.h, line 650") at global/qglobal.cpp:2058 #10 0xb727d25d in qFatal (msg=0xb73fafa4 "ASSERT: \"%s\" in file %s, line %d") at global/qglobal.cpp:2260 #11 0xb727d6d9 in qt_assert (assertion=0xb7e25971 "i >= 0 && i < size()", file=0xb7e25940 "/home/kde-devel/qt-copy/include/QtCore/qstring.h", line=650) at global/qglobal.cpp:1828 #12 0xb7d4068e in QString::at (this=0xbfc19e60, i=0) at /home/kde-devel/qt-copy/include/QtCore/qstring.h:650 #13 0xb7d3f4d4 in KUrlCompletionPrivate::MyURL::init (this=0xbfc19ed4, _url=@0xbfc1a388, cwd=@0x8167048) at /home/kde-devel/kde/src/KDE/kdelibs/kio/kio/kurlcompletion.cpp:486 #14 0xb7d3f755 in MyURL (this=0xbfc19ed4, _url=@0xbfc1a388, cwd=@0x8167048) at /home/kde-devel/kde/src/KDE/kdelibs/kio/kio/kurlcompletion.cpp:444 #15 0xb7d3f912 in KUrlCompletion::makeCompletion (this=0x8178fe8, text=@0xbfc1a388) at /home/kde-devel/kde/src/KDE/kdelibs/kio/kio/kurlcompletion.cpp:621 #16 0xb7f4683c in KonqMainWindow::slotMakeCompletion (this=0x810d7c0, text=@0xbfc1a388) at /home/kde-devel/kde/src/KDE/kdebase/apps/konqueror/src/konqmainwindow.cpp:3045 #17 0xb7f5f66b in KonqMainWindow::qt_metacall (this=0x810d7c0, _c=QMetaObject::InvokeMetaMethod, _id=105, _a=0xbfc1a0ec) at /home/kde-devel/kde/build/KDE/kdebase/apps/konqueror/src/konqmainwindow.moc:434 #18 0xb73af051 in QMetaObject::activate (sender=0x81483a8, from_signal_index=53, to_signal_index=53, argv=0xbfc1a0ec) at kernel/qobject.cpp:3010 #19 0xb73af5db in QMetaObject::activate (sender=0x81483a8, m=0xb7bf8e5c, local_signal_index=2, argv=0xbfc1a0ec) at kernel/qobject.cpp:3080 #20 0xb7b14566 in KComboBox::completion (this=0x81483a8, _t1=@0xbfc1a388) at /home/kde-devel/kde/build/KDE/kdelibs/kdeui/kcombobox.moc:174 #21 0xb7b15459 in KComboBox::qt_metacall (this=0x81483a8, _c=QMetaObject::InvokeMetaMethod, _id=2, _a=0xbfc1a27c) at /home/kde-devel/kde/build/KDE/kdelibs/kdeui/kcombobox.moc:106 #22 0xb7b2a8d6 in KHistoryComboBox::qt_metacall (this=0x81483a8, _c=QMetaObject::InvokeMetaMethod, _id=53, _a=0xbfc1a27c) at /home/kde-devel/kde/build/KDE/kdelibs/kdeui/khistorycombobox.moc:76 #23 0xb7f38f6a in KonqCombo::qt_metacall (this=0x81483a8, _c=QMetaObject::InvokeMetaMethod, _id=53, _a=0xbfc1a27c) at /home/kde-devel/kde/build/KDE/kdebase/apps/konqueror/src/konqcombo.moc:68 #24 0xb73af051 in QMetaObject::activate (sender=0x817c010, from_signal_index=48, to_signal_index=48, argv=0xbfc1a27c) at kernel/qobject.cpp:3010 #25 0xb73af5db in QMetaObject::activate (sender=0x817c010, m=0xb7bfa480, local_signal_index=2, argv=0xbfc1a27c) at kernel/qobject.cpp:3080 #26 0xb7b316dc in KLineEdit::completion (this=0x817c010, _t1=@0xbfc1a388) at /home/kde-devel/kde/build/KDE/kdelibs/kdeui/klineedit.moc:219 #27 0xb7b31880 in KLineEditPrivate::doCompletion (this=0x8142a00, txt=@0xbfc1a388) at /home/kde-devel/kde/src/KDE/kdelibs/kdeui/widgets/klineedit.cpp:1698 #28 0xb7b363df in KLineEdit::keyPressEvent (this=0x817c010, e=0xbfc1ad14) at /home/kde-devel/kde/src/KDE/kdelibs/kdeui/widgets/klineedit.cpp:833 #29 0xb658d286 in QWidget::event (this=0x817c010, event=0xbfc1ad14) at kernel/qwidget.cpp:6962 #30 0xb6974872 in QLineEdit::event (this=0x817c010, e=0xbfc1ad14) at widgets/qlineedit.cpp:1602 #31 0xb7b33931 in KLineEdit::event (this=0x817c010, ev=0xbfc1ad14) at /home/kde-devel/kde/src/KDE/kdelibs/kdeui/widgets/klineedit.cpp:1296 #32 0xb6921606 in QComboBox::keyPressEvent (this=0x81483a8, e=0xbfc1ad14) at widgets/qcombobox.cpp:2797 #33 0xb7b29f0f in KHistoryComboBox::keyPressEvent (this=0x81483a8, e=0xbfc1ad14) at /home/kde-devel/kde/src/KDE/kdelibs/kdeui/widgets/khistorycombobox.cpp:345 #34 0xb7f39327 in KonqCombo::keyPressEvent (this=0x81483a8, e=0xbfc1ad14) at /home/kde-devel/kde/src/KDE/kdebase/apps/konqueror/src/konqcombo.cpp:429 #35 0xb658d286 in QWidget::event (this=0x81483a8, event=0xbfc1ad14) at kernel/qwidget.cpp:6962 #36 0xb6924316 in QComboBox::event (this=0x81483a8, event=0xbfc1ad14) at widgets/qcombobox.cpp:2614 #37 0xb6523f55 in QApplicationPrivate::notify_helper (this=0x805d2b8, receiver=0x81483a8, e=0xbfc1ad14) at kernel/qapplication.cpp:3772 #38 0xb6524555 in QApplication::notify (this=0xbfc1b7e0, receiver=0x81483a8, e=0xbfc1ad14) at kernel/qapplication.cpp:3420 #39 0xb7a797dd in KApplication::notify (this=0xbfc1b7e0, receiver=0x81483a8, event=0xbfc1ad14) at /home/kde-devel/kde/src/KDE/kdelibs/kdeui/kernel/kapplication.cpp:311 #40 0xb739724d in QCoreApplication::notifyInternal (this=0xbfc1b7e0, receiver=0x81483a8, event=0xbfc1ad14) at kernel/qcoreapplication.cpp:587 #41 0xb65318db in QCoreApplication::sendSpontaneousEvent (receiver=0x81483a8, event=0xbfc1ad14) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:218 #42 0xb659c51a in qt_sendSpontaneousEvent (receiver=0x81483a8, event=0xbfc1ad14) at kernel/qapplication_x11.cpp:4680 #43 0xb65dc8d1 in QKeyMapper::sendKeyEvent (keyWidget=0x81483a8, grab=false, type=QEvent::KeyPress, code=16777219, modifiers=@0xbfc1ae78, text=@0xbfc1aeac, autorepeat=false, count=1, nativeScanCode=22, nativeVirtualKey=65288, nativeModifiers=16) at kernel/qkeymapper_x11.cpp:1656 #44 0xb65ddd7f in QKeyMapperPrivate::translateKeyEvent (this=0x80809b0, keyWidget=0x81483a8, event=0xbfc1b43c, grab=false) at kernel/qkeymapper_x11.cpp:1627 #45 0xb65b0960 in QApplication::x11ProcessEvent (this=0xbfc1b7e0, event=0xbfc1b43c) at kernel/qapplication_x11.cpp:3148 #46 0xb65e06e1 in x11EventSourceDispatch (s=0x8060238, callback=0, user_data=0x0) at kernel/qguieventdispatcher_glib.cpp:148 #47 0xb5fe1bf8 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0 #48 0xb5fe4e5e in ?? () from /usr/lib/libglib-2.0.so.0 #49 0xb5fe53ac in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0 #50 0xb73cc78c in QEventDispatcherGlib::processEvents (this=0x805ac58, flags=@0xbfc1b5d4) at kernel/qeventdispatcher_glib.cpp:325 #51 0xb65dfdb0 in QGuiEventDispatcherGlib::processEvents (this=0x805ac58, flags=@0xbfc1b604) at kernel/qguieventdispatcher_glib.cpp:204 #52 0xb7393aca in QEventLoop::processEvents (this=0xbfc1b68c, flags=@0xbfc1b644) at kernel/qeventloop.cpp:149 #53 0xb7393d09 in QEventLoop::exec (this=0xbfc1b68c, flags=@0xbfc1b694) at kernel/qeventloop.cpp:200 #54 0xb7397b84 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:845 #55 0xb6523c6e in QApplication::exec () at kernel/qapplication.cpp:3304 #56 0xb7f8f4b6 in kdemain (argc=1, argv=0xbfc1baf4) at /home/kde-devel/kde/src/KDE/kdebase/apps/konqueror/src/konqmain.cpp:227 #57 0x080487a6 in main (argc=) at /home/kde-devel/kde/build/KDE/kdebase/apps/konqueror/src/konqueror_dummy.cpp:3 Note that this looks like a duplicate of bug #157167. The strange thing is that this bug has been closed with "WORKSFORME". The difference in the backtraces I was surprised about in my last comment might be due to different Qt compilation options. The only real difference seems to be that qt_message_output () calls abort () and not exit () in my case. Note that the same issue occurs in Dolphin from SVN trunk: If you set the text completion method in the location bar to "Automatic", enter "/" in the location bar, wait for a suggested completion to appear and press backspace, you get a crash (the backtrace looks a bit different). Maybe this bug should be reassigned to "kdelibs/kdeui"? I've looked at the code and got the impression that the problem is in the method KUrlCompletionPrivate::MyURL::init in the file kdelibs/kio/kio/kurlcompletion.cpp. In lines 487 and 488, the method at() of the QString url_copy is called to get the first character of url_copy without checking if the string is empty. When reproducing this bug, url_copy is indeed empty after hitting backspace, and this causes the crash. I'm reassigning this report to kdelibs. Created attachment 26953 [details]
Suggested patch
This patch checks if the string is empty before url_copy.at(0) is called. Fixes the problem for me in trunk.
Created attachment 27573 [details]
Improved patch
I've improved my patch a bit:
1. My last patch solved only one half of the problem, I still left one dangerous url_copy::at (0) without emptiness check in the code.
2. Now I've just replaced 'url_copy::at (0) == ...' by 'url_copy::startsWith (...)', I think this is both shorter and easier to read than my previous approach.
Created attachment 27574 [details] Extended patch (trying to reduce the code complexity) This extended patch simplifies the code a bit by a reordering of the if-statements. The result looks equivalent to me, but it is a few lines shorter and easier to read (at least for me). Note that I sent the patch to the kfm-devel list a while ago, some additional information can be found there: http://lists.kde.org/?t=121936400900001&r=1&w=2 *** Bug 157167 has been marked as a duplicate of this bug. *** Looks good, the only thing missing is an addition to the unit test kurlcompletiontest.cpp :-) Frank sent me an updated patch. Committed (trunk r867376, 4.1-branch r867378). Thanks! |