Bug 100308

Summary: Selecting the whole screen using the Ctrl+Alt keys lets Konsole crash
Product: [Applications] konsole Reporter: Tijmen Baarda <tijmenbaarda>
Component: generalAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED FIXED    
Severity: crash    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Tijmen Baarda 2005-02-26 15:45:37 UTC
Version:            (using KDE KDE 3.3.92)
Installed from:    Compiled From Sources
Compiler:          gcc (GCC) 3.3.5 (Debian 1:3.3.5-8) 
OS:                Linux

When I select the whole screen in Konsole using Ctrl+Alt (box selection), konsole crashes after a few seconds. It outputs "Alarm clock". 

No DrKonqi is shown, but using gdb I got the following backtrace:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 1097249952 (LWP 5339)]
0x4146dd2d in mallopt () from /lib/tls/libc.so.6
(gdb) bt
#0  0x4146dd2d in mallopt () from /lib/tls/libc.so.6
#1  0x4146d578 in mallopt () from /lib/tls/libc.so.6
#2  0x4146c8c3 in malloc () from /lib/tls/libc.so.6
#3  0x413a82fe in operator new () from /usr/lib/libstdc++.so.5
#4  0x413a842f in operator new[] () from /usr/lib/libstdc++.so.5
#5  0x400a2988 in TEScreen::getSelText () from /usr/lib/libkdeinit_konsole.so
#6  0x400a2cfa in TEScreen::getSelText () from /usr/lib/libkdeinit_konsole.so
#7  0x400a292f in TEScreen::getSelText () from /usr/lib/libkdeinit_konsole.so
#8  0x400a515a in TEmulation::setSelection () from /usr/lib/libkdeinit_konsole.so
#9  0x400a3dca in TEmulation::qt_invoke () from /usr/lib/libkdeinit_konsole.so
#10 0x4009c4ea in TEmuVt102::qt_invoke () from /usr/lib/libkdeinit_konsole.so
#11 0x40d4c5ac in QObject::activate_signal () from /usr/lib/libqt-mt.so.3
#12 0x40d4cbe0 in QObject::activate_signal_bool () from /usr/lib/libqt-mt.so.3
#13 0x4009bcc6 in TEWidget::endSelectionSignal () from /usr/lib/libkdeinit_konsole.so
#14 0x40098a67 in TEWidget::mouseReleaseEvent () from /usr/lib/libkdeinit_konsole.so
#15 0x40d82737 in QWidget::event () from /usr/lib/libqt-mt.so.3
#16 0x40099f42 in TEWidget::event () from /usr/lib/libkdeinit_konsole.so
#17 0x40cefbff in QApplication::internalNotify () from /usr/lib/libqt-mt.so.3
#18 0x40cef2f4 in QApplication::notify () from /usr/lib/libqt-mt.so.3
#19 0x40896e03 in KApplication::notify () from /usr/lib/libkdecore.so.4
#20 0x40c84650 in QETWidget::translateMouseEvent () from /usr/lib/libqt-mt.so.3
#21 0x40c822de in QApplication::x11ProcessEvent () from /usr/lib/libqt-mt.so.3
#22 0x40c991c4 in QEventLoop::processEvents () from /usr/lib/libqt-mt.so.3
#23 0x40d01f58 in QEventLoop::enterLoop () from /usr/lib/libqt-mt.so.3
#24 0x40d01e08 in QEventLoop::exec () from /usr/lib/libqt-mt.so.3
#25 0x40cefe51 in QApplication::exec () from /usr/lib/libqt-mt.so.3
#26 0x4006cb35 in kdemain () from /usr/lib/libkdeinit_konsole.so
#27 0x0804862b in ?? ()
#28 0x00000001 in ?? ()
#29 0xbffffbe4 in ?? ()
#30 0xbffffbb8 in ?? ()
#31 0x41410904 in __libc_start_main () from /lib/tls/libc.so.6
#32 0x41410904 in __libc_start_main () from /lib/tls/libc.so.6
#33 0x08048561 in ?? ()
Comment 1 Kurt Hindenburg 2005-02-26 16:01:05 UTC
konsole: /home/kvh/CVS/KDE/CVS-kde/kdebase/konsole/konsole/TEScreen.cpp:1336: void TEScreen::getSelText(bool, QTextStream*): Assertion `d <= columns' failed.
KCrash: crashing... crashRecursionCounter = 2
KCrash: Application Name = konsole path = <unknown> pid = 2269

Comment 2 Kurt Hindenburg 2005-02-26 16:18:11 UTC
I can only reproduce when selecting horizontally the full width of the screen.

Putting a debug in the LINE_END, I get
konsole: LINE_END    d=1900;  columns=100
Comment 3 Waldo Bastian 2005-02-26 18:32:42 UTC
CVS commit by waba: 

Don't crash when selecting full line with Ctrl+Alt
BUG: 100308


  M +5 -0      TEScreen.cpp   1.88


--- kdebase/konsole/konsole/TEScreen.cpp  #1.87:1.88
@@ -1323,4 +1323,9 @@ void TEScreen::getSelText(bool preserve_
             newlineneeded = true;
           }
+          if (((s - hist_BR) % columns == 0) && newlineneeded)
+          {
+            LINE_END;
+            newlineneeded = false;
+          }
         }
         else {


Comment 4 Waldo Bastian 2005-02-26 18:36:06 UTC
It failed to put in linebreaks when the selection was the full screen width.