Bug 205495

Summary: Search - clicking previous while a match is on top line causes crash (temp workaround commited)
Product: [Applications] konsole Reporter: Constantin Berzan <cberzan>
Component: generalAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED FIXED    
Severity: crash CC: adaptee, andresbajotierra
Priority: NOR Keywords: investigated, junior-jobs
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Constantin Berzan 2009-08-28 16:22:11 UTC
Version:            (using Devel)
Compiler:          gcc version 4.3.3 (Ubuntu 4.3.3-5ubuntu4) 
OS:                Linux
Installed from:    Compiled sources

Open konsole. Usually the shell shows something on the first line, such as "user@hostname". Press Ctrl+Shift+F (or Scrollback > Search output), and type something that appears on the first line (such as "hostname"). Now press 'Previous' in the search bar.

This crashes my Konsole both in 4.3.0 and in latest svn trunk.  I have the following options in the search bar:
[x] Highlight all
[ ] Match case
[ ] Match regexp

Here is the relevant information from gdb:

(gdb) bt                                    
#0  0xb7f37430 in __kernel_vsyscall ()      
#1  0xb61786d0 in raise () from /lib/tls/i686/cmov/libc.so.6
#2  0xb617a098 in abort () from /lib/tls/i686/cmov/libc.so.6
#3  0xb717f450 in qt_message_output (msgType=QtFatalMsg,    
    buf=0x9042528 "ASSERT: \"top >= 0 && left >= 0 && bottom >= 0 && right >= 0\" in file /k/kdebase/apps/konsole/src/Screen.cpp, line 1140")
    at global/qglobal.cpp:2042                                                                                                               
#4  0xb717f4c9 in qFatal (msg=0xb730a904 "ASSERT: \"%s\" in file %s, line %d") at global/qglobal.cpp:2241                                    
#5  0xb717f97c in qt_assert (assertion=0xb7f09f50 "top >= 0 && left >= 0 && bottom >= 0 && right >= 0",                                      
    file=0xb7f09d4c "/k/kdebase/apps/konsole/src/Screen.cpp", line=1140) at global/qglobal.cpp:1811                                          
#6  0xb7eb2c95 in Konsole::Screen::writeToStream (this=0x87bc018, decoder=0xbfe50da4, startIndex=-103, endIndex=102, preserveLineBreaks=true)
    at /k/kdebase/apps/konsole/src/Screen.cpp:1140                                                                                           
#7  0xb7eb2e3d in Konsole::Screen::writeLinesToStream (this=0x87bc018, decoder=0xbfe50da4, fromLine=-1, toLine=0)                            
    at /k/kdebase/apps/konsole/src/Screen.cpp:1277                                                                                           
#8  0xb7e83f69 in Konsole::Emulation::writeToStream (this=0x87bc710, _decoder=0xbfe50da4, startLine=-1, endLine=0)                           
    at /k/kdebase/apps/konsole/src/Emulation.cpp:296                                                                                         
#9  0xb7ebf729 in Konsole::SearchHistoryTask::executeOnScreenWindow (this=0x9043eb0, session={o = 0xbfe50e50}, window={o = 0xbfe50e4c})      
    at /k/kdebase/apps/konsole/src/SessionController.cpp:1301                                                                                
#10 0xb7ebf9e1 in Konsole::SearchHistoryTask::execute (this=0x9043eb0) at /k/kdebase/apps/konsole/src/SessionController.cpp:1218             
#11 0xb7ec1991 in Konsole::SessionController::beginSearch (this=0x87e7100, text=@0xbfe50ed0, direction=1)                                    
    at /k/kdebase/apps/konsole/src/SessionController.cpp:788                                                                                 
#12 0xb7ec1a70 in Konsole::SessionController::findPreviousInHistory (this=0x87e7100) at /k/kdebase/apps/konsole/src/SessionController.cpp:819
#13 0xb7ec5f6a in Konsole::SessionController::qt_metacall (this=0x87e7100, _c=QMetaObject::InvokeMetaMethod, _id=13, _a=0xbfe50f98)          
    at /bk/kdebase/apps/konsole/src/SessionController.moc:149                                                                                
#14 0xb72bebc7 in QMetaObject::activate (sender=0x87e6b20, from_signal_index=29, to_signal_index=29, argv=0x0) at kernel/qobject.cpp:3112    
#15 0xb72c0269 in QMetaObject::activate (sender=0x87e6b20, m=0xb7f18284, local_signal_index=2, argv=0x0) at kernel/qobject.cpp:3186          
#16 0xb7e91ced in Konsole::IncrementalSearchBar::findPreviousClicked (this=0x87e6b20) at /bk/kdebase/apps/konsole/src/IncrementalSearchBar.moc:114
#17 0xb7e92006 in Konsole::IncrementalSearchBar::qt_metacall (this=0x87e6b20, _c=QMetaObject::InvokeMetaMethod, _id=2, _a=0xbfe5111c)             
    at /bk/kdebase/apps/konsole/src/IncrementalSearchBar.moc:84                                                                                   
#18 0xb72bebc7 in QMetaObject::activate (sender=0x87e93c0, from_signal_index=29, to_signal_index=30, argv=0xbfe5111c) at kernel/qobject.cpp:3112  
#19 0xb72beef4 in QMetaObject::activate (sender=0x87e93c0, m=0xb707a184, from_local_signal_index=2, to_local_signal_index=3, argv=0xbfe5111c)     
    at kernel/qobject.cpp:3206                                                                                                                    
#20 0xb6e3e9ec in QAbstractButton::clicked (this=0x87e93c0, _t1=false) at .moc/debug-shared/moc_qabstractbutton.cpp:200                           
#21 0xb6af8cfa in QAbstractButtonPrivate::emitClicked (this=0x87e9078) at widgets/qabstractbutton.cpp:543                                         
#22 0xb6afa237 in QAbstractButtonPrivate::click (this=0x87e9078) at widgets/qabstractbutton.cpp:536
#23 0xb6afa530 in QAbstractButton::mouseReleaseEvent (this=0x87e93c0, e=0xbfe51858) at widgets/qabstractbutton.cpp:1115
#24 0xb6c0db2e in QToolButton::mouseReleaseEvent (this=0x87e93c0, e=0xbfe51858) at widgets/qtoolbutton.cpp:709
#25 0xb67069f1 in QWidget::event (this=0x87e93c0, event=0xbfe51858) at kernel/qwidget.cpp:7549
#26 0xb6af8c93 in QAbstractButton::event (this=0x87e93c0, e=0xbfe51858) at widgets/qabstractbutton.cpp:1077
#27 0xb6c0edda in QToolButton::event (this=0x87e93c0, event=0xbfe51858) at widgets/qtoolbutton.cpp:1151
#28 0xb6695bc3 in QApplicationPrivate::notify_helper (this=0x86ea9c8, receiver=0x87e93c0, e=0xbfe51858) at kernel/qapplication.cpp:4056
#29 0xb6696860 in QApplication::notify (this=0xbfe53220, receiver=0x87e93c0, e=0xbfe51858) at kernel/qapplication.cpp:3758
#30 0xb784ceb7 in KApplication::notify (this=0xbfe53220, receiver=0x87e93c0, event=0xbfe51858) at /k/kdelibs/kdeui/kernel/kapplication.cpp:302
---Type <return> to continue, or q <return> to quit---
#31 0xb72a4296 in QCoreApplication::notifyInternal (this=0xbfe53220, receiver=0x87e93c0, event=0xbfe51858) at kernel/qcoreapplication.cpp:610
#32 0xb66a3cc3 in QCoreApplication::sendSpontaneousEvent (receiver=0x87e93c0, event=0xbfe51858)
    at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:216
#33 0xb669b329 in QApplicationPrivate::sendMouseEvent (receiver=0x87e93c0, event=0xbfe51858, alienWidget=0x87e93c0, nativeWidget=0x8772958,
    buttonDown=0xb7088ce0, lastMouseReceiver=@0xb7088ce4) at kernel/qapplication.cpp:2924
#34 0xb6730ec9 in QETWidget::translateMouseEvent (this=0x8772958, event=0xbfe52f1c) at kernel/qapplication_x11.cpp:4409
#35 0xb6732351 in QApplication::x11ProcessEvent (this=0xbfe53220, event=0xbfe52f1c) at kernel/qapplication_x11.cpp:3428
#36 0xb6762ff2 in x11EventSourceDispatch (s=0x86ec1a8, callback=0, user_data=0x0) at kernel/qguieventdispatcher_glib.cpp:146
#37 0xb5e82b88 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#38 0xb5e860eb in ?? () from /usr/lib/libglib-2.0.so.0
#39 0xb5e86268 in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#40 0xb72db5b6 in QEventDispatcherGlib::processEvents (this=0x86cace8, flags={i = -1075498796}) at kernel/qeventdispatcher_glib.cpp:327
#41 0xb6762664 in QGuiEventDispatcherGlib::processEvents (this=0x86cace8, flags={i = -1075498748}) at kernel/qguieventdispatcher_glib.cpp:202
#42 0xb72a0950 in QEventLoop::processEvents (this=0xbfe531a8, flags={i = -1075498664}) at kernel/qeventloop.cpp:149
#43 0xb72a0bc2 in QEventLoop::exec (this=0xbfe531a8, flags={i = -1075498576}) at kernel/qeventloop.cpp:201
#44 0xb72a4beb in QCoreApplication::exec () at kernel/qcoreapplication.cpp:888
#45 0xb66958dc in QApplication::exec () at kernel/qapplication.cpp:3525
#46 0xb7f302dd in kdemain (argc=2, argv=0xbfe53354) at /k/kdebase/apps/konsole/src/main.cpp:104
#47 0x08048756 in main (argc=Cannot access memory at address 0x6664
) at /bk/kdebase/apps/konsole/src/konsole_dummy.cpp:3
(gdb) f 6
#6  0xb7eb2c95 in Konsole::Screen::writeToStream (this=0x87bc018, decoder=0xbfe50da4, startIndex=-103, endIndex=102, preserveLineBreaks=true)
    at /k/kdebase/apps/konsole/src/Screen.cpp:1140
1140        Q_ASSERT( top >= 0 && left >= 0 && bottom >= 0 && right >= 0 );
(gdb) p top
$1 = -1
(gdb) p left
$2 = 0
(gdb) p bottom
$3 = 0
(gdb) p right
$4 = 102
(gdb)
Comment 1 Dario Andres 2009-08-28 19:50:45 UTC
I can reproduce the crash here using:

Qt: 4.5.2 (KDE-Qt git commit 5b7a2eb42acfdea07c6075556cb43e2c95852145
        Date:   Tue Jul 28 14:10:47 2009 -0300)
KDE: 4.3.64 (KDE 4.3.64 (KDE 4.4 >= 20090812))
kdelibs svn rev. 1013119 / kdebase svn rev. 1013119
on ArchLinux i686 - Kernel 2.6.30.4

Thanks
Comment 2 Kurt Hindenburg 2009-08-31 06:48:36 UTC
SVN commit 1017656 by hindenburg:

Temporary fix for crashing during Search when there is a match on top line.

CCBUG: 205495


 M  +3 -1      SessionController.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1017656
Comment 3 Kurt Hindenburg 2009-09-02 05:54:57 UTC
SVN commit 1018673 by hindenburg:

Temporary fix for crashing during Search when there is a match on top line.

CCBUG: 205495


 M  +3 -1      SessionController.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1018673