Bug 235046

Summary: Triple click on empty document crashes KWrite
Product: [Applications] kate Reporter: Hakan Bayindir <hakan>
Component: kwriteAssignee: KWrite Developers <kwrite-bugs-null>
Status: RESOLVED FIXED    
Severity: crash CC: annma
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Hakan Bayindir 2010-04-22 10:42:29 UTC
Version:           4.3.4 (KDE 4.3.4) (using 4.3.4 (KDE 4.3.4), Debian packages)
Compiler:          cc
OS:                Linux (i686) release 2.6.32-3-686-bigmem

Triple clicking on KWrite's edit text area (the big textarea where you actually write your document) causes a crash if the text area is either empty or only contains whitespace characters.

How to Reproduce:
1- Open Kwrite
2- Triple click to text area
3- Kaboom! Kwrite is gone.
4- You reproduced the bug, congrats :)

Expected behavior:
1- Open Kwrite
2- Triple click to text area
3- Select the whole line if characters present, nothing happens otherwise.

A developer's insight:
Since the bug occurs when the text area contains no printable characters, the line select code is causing crash IMHO.
Comment 1 Hakan Bayindir 2010-04-22 12:57:23 UTC
Update:

Triple clicking any completely blank line in a KWrite also causes it to crash.
Comment 2 Anne-Marie Mahfouf 2010-04-22 13:43:20 UTC
I cannot reproduce here on 4.4 branch.
Do you get a valid backtrace (you need debug packages for the backtrace to be valid)for the crash please?

How do you input your triple click?
Comment 3 Andreas Pakulat 2010-04-22 14:17:32 UTC
I can reproduce this here with KDE 4.3, but it seems to be impossible to get a useful backtrace out with gdb. Will try valgrind.
Comment 4 Andreas Pakulat 2010-04-22 14:21:23 UTC
==5038== Process terminating with default action of signal 11 (SIGSEGV)
==5038==  Access not within mapped region at address 0x18
==5038==    at 0x93561B5: KateLineLayout::viewLineCount() const (katelinelayout.cpp:173)
==5038==    by 0x9352E2B: KateLayoutCache::viewLine(KTextEditor::Cursor const&) const (katelayoutcache.cpp:392)
==5038==    by 0x93AC086: KateViewInternal::viewLineOffset(KTextEditor::Cursor const&, int, bool) (kateviewinternal.cpp:1331)
==5038==    by 0x93AFF28: KateViewInternal::makeVisible(KTextEditor::Cursor const&, int, bool, bool, bool) (kateviewinternal.cpp:667)
==5038==    by 0x93B036F: KateViewInternal::updateCursor(KTextEditor::Cursor const&, bool, bool, bool) (kateviewinternal.cpp:1869)
==5038==    by 0x93B4CBB: KateViewInternal::mousePressEvent(QMouseEvent*) (kateviewinternal.cpp:2532)
==5038==    by 0x49ADAFD: QWidget::event(QEvent*) (qwidget.cpp:7550)
==5038==    by 0x4957A93: QApplicationPrivate::notify_helper(QObject*, QEvent*) (qapplication.cpp:4065)
==5038==    by 0x4960550: QApplication::notify(QObject*, QEvent*) (qapplication.cpp:3767)
==5038==    by 0x4658E29: KApplication::notify(QObject*, QEvent*) (kapplication.cpp:302)
==5038==    by 0x55631EA: QCoreApplication::notifyInternal(QObject*, QEvent*) (qcoreapplication.cpp:610)
==5038==    by 0x495F5DD: QApplicationPrivate::sendMouseEvent(QWidget*, QMouseEvent*, QWidget*, QWidget*, QWidget**, QPointer<QWidget>&) (qcoreapplication.h:216)


Thats the valgrind log and I recall that a fix for this was comitted for 4.4 already. Hence closing, if anybody can reproduce with 4.4 please re-open, all you have to do is start kwrite and click three times in the edit area.