Bug 76558 - Kdevelop crashes by Event onClick Documentation SiteBar
Summary: Kdevelop crashes by Event onClick Documentation SiteBar
Status: RESOLVED FIXED
Alias: None
Product: kdevelop
Classification: Applications
Component: doctreeview (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR crash
Target Milestone: ---
Assignee: KDevelop Developers
URL:
Keywords:
: 76921 77728 78605 79672 81997 82490 (view as bug list)
Depends on:
Blocks:
 
Reported: 2004-03-02 12:34 UTC by Juergen Heinemann
Modified: 2004-06-16 18:34 UTC (History)
9 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Patch from comment #6 as an attachment. (814 bytes, patch)
2004-03-29 00:12 UTC, Jonathan Solomon
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Juergen Heinemann 2004-03-02 12:34:31 UTC
Version:           Kdevelop 3.0.90-CVS (using KDE KDE 3.2.0)
Installed from:    SuSE RPMs
Compiler:          gcc (GCC) 3.3.1 (SuSE Linux) ./configure --prefix=/opt/kde3 --sysconfdir=/etc --enable-autoproject --enable-scriptproject --enable-trollproject --enable-customproject --enable-cvs --with-qtdoc-dir=/usr/lib/qt3/doc/html --with-extra-libs=/srv/www/modules:/opt/kde3/lib:/usr/lib/qt3/lib --with-extra-includes=/opt/kde3/include:/usr/lib/qt3/include --enable-kate --enable-kdbg --enable-kwrite --enable-quanta --enable-perforce --enable-clearcase --enable-nmcheck --enable-closure
OS:          Linux

Application crashes if onClick the Documentation SiteBar.

[New Thread 16384 (LWP 28137)]
[New Thread 32769 (LWP 28142)]
[New Thread 16384 (LWP 28137)]
[New Thread 32769 (LWP 28142)]
[New Thread 16384 (LWP 28137)]
[New Thread 32769 (LWP 28142)]
[New Thread 16386 (LWP 28143)]
0x41912ab6 in waitpid () from /lib/i686/libpthread.so.0
#0  0x41912ab6 in waitpid () from /lib/i686/libpthread.so.0
#1  0x40e1ea7a in KCrash::defaultCrashHandler(int) ()
   from /opt/kde3/lib/libkdecore.so.4
#2  0x4191196c in __pthread_sighandler () from /lib/i686/libpthread.so.0
#3  <signal handler called>
#4  0x40f8650c in KStyle::drawComplexControl(QStyle::ComplexControl, QPainter*, QWidget const*, QRect const&, QColorGroup const&, unsigned, unsigned, unsigned, QStyleOption const&) const () from /opt/kde3/lib/libkdefx.so.4
#5  0x41c7f65e in LiquidStyle::drawComplexControl(QStyle::ComplexControl, QPainter*, QWidget const*, QRect const&, QColorGroup const&, unsigned, unsigned, unsigned, QStyleOption const&) const ()
   from /opt/kde3/lib/kde3/plugins/styles/liquid.so
#6  0x41334393 in QListViewItem::paintBranches(QPainter*, QColorGroup const&, int, int, int) () from /usr/lib/qt3/lib/libqt-mt.so.3
#7  0x41335e50 in QListView::drawContentsOffset(QPainter*, int, int, int, int, int, int) () from /usr/lib/qt3/lib/libqt-mt.so.3
#8  0x4136bd15 in QScrollView::viewportPaintEvent(QPaintEvent*) ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#9  0x40b65d24 in KListView::viewportPaintEvent(QPaintEvent*) ()
   from /opt/kde3/lib/libkdeui.so.4
#10 0x4136b92c in QScrollView::eventFilter(QObject*, QEvent*) ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#11 0x41338b78 in QListView::eventFilter(QObject*, QEvent*) ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#12 0x4125403e in QObject::activate_filters(QEvent*) ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#13 0x41253f30 in QObject::event(QEvent*) ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#14 0x4128d97f in QWidget::event(QEvent*) ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#15 0x411f5776 in QApplication::internalNotify(QObject*, QEvent*) ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#16 0x411f4a9e in QApplication::notify(QObject*, QEvent*) ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#17 0x40d9e464 in KApplication::notify(QObject*, QEvent*) ()
   from /opt/kde3/lib/libkdecore.so.4
#18 0x411bc5e9 in QWidget::repaint(int, int, int, int, bool) ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#19 0x4128ecdb in QWidget::repaint(bool) () from /usr/lib/qt3/lib/libqt-mt.so.3
#20 0x41337fc3 in QListView::handleSizeChange(int, int, int) ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#21 0x415ab10f in QListView::qt_invoke(int, QUObject*) ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#22 0x40b69663 in KListView::qt_invoke(int, QUObject*) ()
   from /opt/kde3/lib/libkdeui.so.4
#23 0x412568bb in QObject::activate_signal(QConnectionList*, QUObject*) ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#24 0x415a4f2c in QHeader::sizeChange(int, int, int) ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#25 0x41311821 in QHeader::adjustHeaderSize(int) ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#26 0x41311656 in QHeader::resizeEvent(QResizeEvent*) ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#27 0x4128dec4 in QWidget::event(QEvent*) ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#28 0x411f5776 in QApplication::internalNotify(QObject*, QEvent*) ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#29 0x411f4a9e in QApplication::notify(QObject*, QEvent*) ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#30 0x40d9e464 in KApplication::notify(QObject*, QEvent*) ()
   from /opt/kde3/lib/libkdecore.so.4
#31 0x411f66a1 in QApplication::sendPostedEvents(QObject*, int) ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#32 0x411f6426 in QApplication::sendPostedEvents() ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#33 0x4119b4fd in QEventLoop::processEvents(unsigned) ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#34 0x412081d0 in QEventLoop::enterLoop() ()
   from /usr/lib/qt3/lib/libqt-mt.so.3
#35 0x412080c6 in QEventLoop::exec() () from /usr/lib/qt3/lib/libqt-mt.so.3
#36 0x411f5a0f in QApplication::exec() () from /usr/lib/qt3/lib/libqt-mt.so.3
#37 0x080649dc in main ()
Comment 1 Jens Dagerbo 2004-03-02 14:22:12 UTC
Dupe

*** This bug has been marked as a duplicate of 69441 ***
Comment 2 Juergen Heinemann 2004-03-02 17:24:43 UTC
Ok, Sorry i didn't find it in Bug Search.
Comment 3 Alexander Dymo 2004-03-02 18:10:35 UTC
Opening again. Yes, this is another KStyle related problem, but at least I know how to fix it ;)

If you replace DocTreeViewWidget::projectChanged method with
void DocTreeViewWidget::projectChanged(KDevProject *project)
{
    folder_project->setProject(project);
    QTimer::singleShot(0, this, SLOT(refresh()));
}
you will fix the bug :)
The only reason I haven't commited yet is that this introduce a large delay during opening a project. Also it crashes only with Qt>=3.3beta.

It seems that if we use QListView::takeItem then for some reason the crash in KStyle occurs when repainting the listview.
Comment 4 Winfried Dobbe 2004-03-02 20:26:02 UTC
Reproducable for me when I open a project, close it, then open same or other project and click on documentation tool button.
Comment 5 Jens Dagerbo 2004-03-19 08:17:25 UTC
*** Bug 77728 has been marked as a duplicate of this bug. ***
Comment 6 Jonathan Solomon 2004-03-21 02:33:55 UTC
I've encountered a very similar problem except in QWindowsStyle::drawComplexControl(). Causes crashes on open or close of a new project only when the documentation tab is showing. The following patch (against Qt) is a band-aid for the problem. Please pass it on to the Trolltech guys if you think it worthwhile. (debug kernel 2.6.3.2.1.258-2-1, KDE 3.2.1, Fedora Core 2 test 1

Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --disable-checking --disable-libunwind-exceptions --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.3.3 20040311 (Red Hat Linux 3.3.3-3)


--- qwindowsstyle.cpp	2004-02-18 08:22:55.000000000 -0500
+++ qwindowsstyle.cpp.backup	2004-03-20 20:09:52.576762328 -0500
@@ -1624,7 +1624,16 @@
 		} else {
 		    int linetop = 0, linebot = 0;
+			int numchildren = 0;
 		    // each branch needs at most two lines, ie. four end points
 		    dotoffset = (item->itemPos() + item->height() - y) %2;
-		    dotlines.resize( item->childCount() * 4 );
+			numchildren = item->childCount();
+			if (numchildren < 0) {
+				printf("QWindowsStyle::drawComplexControl: Bogus number of child items (%d) in listview\n",numchildren);
+				numchildren = 0;
+			}
+		    dotlines.resize( numchildren * 4 );
+			if (numchildren == 0) {
+				child = NULL;
+			}
 		    c = 0;
 
Comment 7 Jonathan Solomon 2004-03-21 02:38:17 UTC
Oop! I should also mention that was Qt 3.3.1.
Comment 8 Jens Dagerbo 2004-03-28 15:18:10 UTC
*** Bug 78605 has been marked as a duplicate of this bug. ***
Comment 9 Jonathan Solomon 2004-03-28 15:37:39 UTC
Was just looking at the other bug originally sited as a duplicate. I should add that the crash is happening because a bad ListViewItem is being passed down. The drawComplexControl() method retrieves a negative (or otherwise out-of-range) value for the item's number of children and blows up since it doesn't perform a check. My patch above fixes the blowup but it doesn't address the bad item that's being passed.
Comment 10 Jens Dagerbo 2004-03-28 15:59:10 UTC
I think the problem is our use of the takeItem() method. (See http://doc.trolltech.com/3.3/qlistviewitem.html#takeItem ) The method is known to leave the listviewitem in an "unsafe state". Apparently, the style drawing code doesn't always (ever?) handle this safely. Maybe this is a bug in the drawing code, but we're not likely to get the fix into all 20+ qt/kde-styles that exist.. I guess our best option is to work around the problem in our code.

Comment 11 Jonathan Solomon 2004-03-29 00:12:04 UTC
Created attachment 5454 [details]
Patch from comment #6 as an attachment.

After trying to reapply the above patch (I'd lost the original) I determined
that pasting it in here caused it to be mangled into unusability so I provide
it again as an attachment.
Comment 12 Daniel Franke 2004-03-30 18:06:32 UTC
If any additional help:

qt-3.3.1, KDE-3.2.1, kdevelop-HEAD-2004/03/30

Open/create simple c project (c++, qmake seem to work), open documentation, crash.

-- gdb--
kdevelop (cpp support): newly parsing...
kdevelop (cpp support): updating sourceinfo
kdevelop: ClassViewPart::refresh
kmdi: KMdiDockContainer::tabClicked()
kmdi: KMdiFocusList::addWidgetTree: adding toplevel
kmdi: KMdiFocusList::addWidgetTree: adding toplevel
kmdi: KMdiFocusList::addWidgetTree: adding widget
kmdi: KMdiFocusList::addWidgetTree: adding widget
kmdi: KMdiFocusList::addWidgetTree: adding widget
kmdi: KMdiFocusList::addWidgetTree: adding widget
kmdi: KMdiFocusList::addWidgetTree: adding widget
kmdi: KMdiFocusList::addWidgetTree: adding widget
QGArray::at: Absolute index 0 out of range

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 9673)]
0x410acc53 in KStyle::drawComplexControl(QStyle::ComplexControl, QPainter*, QWidget const*, QRect const&, QColorGroup const&, unsigned, unsigned, unsigned, QStyleOption const&) const (this=0x8179ac0, control=CC_ListView, p=0xbfffe280,
    widget=0x82f2808, r=@0xbfffe010, cg=@0x8177c64, flags=1, controls=6,
    active=0, opt=@0xbfffdfd0) at kstyle.cpp:1215
1215                                                            dotlines[c++] = QPoint( bx, linetop );


--backtrace (truncated)--
backtrace:
#0  0x410acc53 in KStyle::drawComplexControl(QStyle::ComplexControl, QPainter*, QWidget const*, QRect const&, QColorGroup const&, unsigned, unsigned, unsigned, QStyleOption const&) const (this=0x8179ac0, control=CC_ListView, p=0xbfffe280,
    widget=0x82f2808, r=@0xbfffe010, cg=@0x8177c64, flags=1, controls=6,
    active=0, opt=@0xbfffdfd0) at kstyle.cpp:1215
#1  0x4206497b in KeramikStyle::drawComplexControl(QStyle::ComplexControl, QPainter*, QWidget const*, QRect const&, QColorGroup const&, unsigned, unsigned, unsigned, QStyleOption const&) const (this=0x8179ac0, control=CC_ListView,
    p=0xbfffe280, widget=0x82f2808, r=@0xbfffe010, cg=@0x8177c64, flags=1,
    controls=6, active=0, opt=@0xbfffdfd0) at keramik.cpp:2291
#2  0x414dc6f5 in QListViewItem::paintBranches(QPainter*, QColorGroup const&, int, int, int) (this=0x82f31a0, p=0xbfffe280, cg=@0x8177c64, w=20, y=0, h=108)
    at widgets/qlistview.cpp:2240
#3  0x414df4e4 in QListView::drawContentsOffset(QPainter*, int, int, int, int, int, int) (this=0x82f2808, p=0xbfffe280, ox=0, oy=0, cx=0, cy=0, cw=21, ch=750)
    at widgets/qlistview.cpp:3004
#4  0x4151e3bd in QScrollView::viewportPaintEvent(QPaintEvent*) (
    this=0x82f2808, pe=0xbfffe970) at widgets/qscrollview.cpp:1704
#5  0x40c8f79d in KListView::viewportPaintEvent(QPaintEvent*) (this=0x82f2808,
    e=0xbfffe970) at klistview.cpp:1882
#6  0x4151db3f in QScrollView::eventFilter(QObject*, QEvent*) (this=0x82f2808,
    obj=0x82f66e8, e=0xbfffe970) at widgets/qscrollview.cpp:1490
#7  0x414e22b7 in QListView::eventFilter(QObject*, QEvent*) (this=0x82f2808,
    o=0x82f66e8, e=0xbfffe970) at widgets/qlistview.cpp:3827
#8  0x413cd465 in QObject::activate_filters(QEvent*) (this=0x82f66e8,
    e=0xbfffe970) at kernel/qobject.cpp:902
Comment 13 Nick Zakharenko 2004-03-31 14:10:08 UTC
If anable all documents in all colections in "Project options"->"Project Documentation" this bug disapire.
Kdevelop crashes onli if some documentation disabled.
Comment 14 Alexander Dymo 2004-03-31 19:35:50 UTC
*** Bug 76921 has been marked as a duplicate of this bug. ***
Comment 15 Marek Vašut 2004-04-10 09:31:39 UTC
I must confirm this.
My KDevelop 3.0.1 on KDE 3.2.0 (Mandrake Linux 10) craches when I:
   open new project - "Sample KDE Application"
   close that project
   open new project - "Sample KDE Application"
   click Documentation on the left side
   -> CRASH
Comment 16 Jens Dagerbo 2004-04-15 11:16:21 UTC
*** Bug 79672 has been marked as a duplicate of this bug. ***
Comment 17 Alexander Dymo 2004-05-08 00:24:51 UTC
Fixed in HEAD. New documentation viewer is not vulnerable to this problem.
Comment 18 Maksim Orlovich 2004-05-09 19:20:24 UTC
*** Bug 69441 has been marked as a duplicate of this bug. ***
Comment 19 Jens Dagerbo 2004-05-23 03:48:19 UTC
*** Bug 81997 has been marked as a duplicate of this bug. ***
Comment 20 Jens Dagerbo 2004-06-01 02:09:43 UTC
*** Bug 82490 has been marked as a duplicate of this bug. ***
Comment 21 Jens Dagerbo 2004-06-16 18:34:54 UTC
*** Bug 82490 has been marked as a duplicate of this bug. ***