Bug#2146: Seg fault when outputting a blank line first thing to cout

jbb jbb at ihug.co.nz
Fri Oct 15 10:00:28 UTC 1999

Package: kdevelop
Version: 1.0 beta3
Severity: grave (ish) bad, if it happens and easy to fix.

Bugreport ID : 23:15,15.10.99

Originator       : jbb
E-Mail   : jbb at ihug.co.nz

Subject : Seg fault when outputting a blank line first thing to cout

Error Class      : software bug
Error Location: ckdevelop.cpp
Priority         : low

Bug Description ---------------------------

If a "KDE Normal" application outputs a blank line to cout before any other
data is output to cout then an assert is generated in qmultiedit, when the
application is run using the "Run" button (phew :-)

here's some simple code that'll trigger the assert.

#include "iostream"
int main(int argc, char* argv[]) {

  cout << endl;

  KApplication app(argc,argv,"term");

This is the ASSERT diagnostic

EXEC:./termQGList::locate: Index 1 out of range
ASSERT: "s" in widgets/qmultilinedit.cpp (1853)
Segmentation fault (core dumped)

This hack :-) will stop the assert

void CKDevelop::slotApplReceivedStdout(KProcess*,char* buffer,int buflen){
  if (*(buffer+buflen-1) == '\n')
  QString str(buffer,buflen+1);

//    int x,y;
//  showOutputView(true);
//  stdin_stdout_widget->cursorPosition(&x,&y);
//  QString str(buffer,buflen+1);
//  stdin_stdout_widget->insertAt(str,x,y);
void CKDevelop::slotApplReceivedStderr(KProcess*,char* buffer,int buflen){
  if (*(buffer+buflen-1) == '\n')
  QString str(buffer,buflen+1);

//  int x,y;
//  showOutputView(true);
//  stderr_widget->cursorPosition(&x,&y);
//  QString str(buffer,buflen+1);
//  stderr_widget->insertAt(str,x,y);

System Information ------------------------

KDevelop version	: 1.0beta3
KDE version		: KDE-1.1.2 (cvs-release)
QT version		: QT-1.44
OS/Distribution		: Mandrake 6.1
Compiler		: gcc-2.95.1

Also using "insertLine()" and "setCursorPosition" as above on the message
window will fix the problem where the output gets messed up if the user
clicks in the message window whilst output is still being generated, as per the
report below.

On Fri, 15 Oct 1999, you wrote:
> Am Fri, 15 Oct 1999 schriebst Du zwecks "BUG: Output window" :
> > Hi,
> > 
> > I found an ugly bug:
> > Whenever I click on a compiler error message line in the output window
> > of KDevelop during compiling, all error lines coming after that click
> > are scrambled.
> > -- 
> > 
> > Ciao,
> > --Falk
> --
> email 1: delta_x at linuxCoding.de
> email 2: delta_x at gmx.net
> home   : HTTP://WWW.LinuxCoding.DE
> why do you click on this line :)
> you MUST wait till kdev has compiled ready

Nooo, it's ugly and can be fixed :-)



More information about the KDevelop-devel mailing list