Bug 87204

Summary: crash when closing with (+)/(-) in filebrowsing mode when directory is not completed with reading content.
Product: [Applications] konqueror Reporter: Edwin Schepers <yez>
Component: generalAssignee: Konqueror Developers <konq-bugs>
Status: RESOLVED FIXED    
Severity: crash CC: bastian
Priority: NOR    
Version: 3.3   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Edwin Schepers 2004-08-14 16:00:44 UTC
Version:           3.3 (using KDE 3.3.0, compiled sources)
Compiler:          gcc version 3.3.2 20031022 (Red Hat Linux 3.3.2-1)
OS:                Linux (i686) release 2.4.22-1.2115.nptl

Hi,
This does not only happen in konqueror, but every application that uses the file-tree, but I don't know which part that is.

When you click on the [+] in front of a directory, the contents of the directory are read. When you close it (click it again) before konqueror has read all contents, it will crash.

konqueror bt:
Using host libthread_db library "/lib/tls/libthread_db.so.1".
[Thread debugging using libthread_db enabled]
[New Thread -1085362048 (LWP 3646)]
[KCrash handler]
#4  0x00cd14de in QValueList<KIO::UDSAtom>::begin() const (this=0x9f0ba3c)
    at qvaluelist.h:474
#5  0x00d7e240 in KFileItem::time(unsigned) const (this=0x9f0ba38, which=262)
    at kfileitem.cpp:331
#6  0x0336a14a in KonqBaseListViewItem::compare(QListViewItem*, int, bool) const (this=0x9f43ee8, item=0x9f40778, col=2, ascending=false)
    at konq_listviewitems.cc:239
#7  0x011f2f66 in QListViewPrivate::SortableItem::cmp(QListViewPrivate::SortableItem const&) const () from /hda8/opt/qt-copy.20040531/lib/libqt-mt.so.3
#8  0x011f2b73 in void qHeapSortHelper<QListViewPrivate::SortableItem*, QListViewPrivate::SortableItem>(QListViewPrivate::SortableItem*, QListViewPrivate::SortableItem*, QListViewPrivate::SortableItem, unsigned) ()
   from /hda8/opt/qt-copy.20040531/lib/libqt-mt.so.3
#9  0x011f2a96 in void qHeapSort<QListViewPrivate::SortableItem*>(QListViewPrivate::SortableItem*, QListViewPrivate::SortableItem*) ()
   from /hda8/opt/qt-copy.20040531/lib/libqt-mt.so.3
#10 0x011e1190 in QListViewItem::sortChildItems(int, bool) ()
   from /hda8/opt/qt-copy.20040531/lib/libqt-mt.so.3
#11 0x011e18aa in QListViewItem::enforceSortOrder() const ()
   from /hda8/opt/qt-copy.20040531/lib/libqt-mt.so.3
#12 0x011e53c1 in QListView::buildDrawableList() const ()
   from /hda8/opt/qt-copy.20040531/lib/libqt-mt.so.3
#13 0x011e50c7 in QListView::drawContentsOffset(QPainter*, int, int, int, int, int, int) () from /hda8/opt/qt-copy.20040531/lib/libqt-mt.so.3
#14 0x01212524 in QScrollView::viewportPaintEvent(QPaintEvent*) ()
   from /hda8/opt/qt-copy.20040531/lib/libqt-mt.so.3
#15 0x0028c80d in KListView::viewportPaintEvent(QPaintEvent*) (this=0x9ca5038, 
    e=0xbff10c70) at klistview.cpp:1893
#16 0x03363e92 in KonqBaseListViewWidget::viewportPaintEvent(QPaintEvent*) (
    this=0x9ca5038, e=0xbff10c70) at konq_listviewwidget.cc:614
#17 0x01212000 in QScrollView::eventFilter(QObject*, QEvent*) ()
   from /hda8/opt/qt-copy.20040531/lib/libqt-mt.so.3
#18 0x011e6ee1 in QListView::eventFilter(QObject*, QEvent*) ()
   from /hda8/opt/qt-copy.20040531/lib/libqt-mt.so.3
#19 0x0111b484 in QObject::activate_filters(QEvent*) ()
   from /hda8/opt/qt-copy.20040531/lib/libqt-mt.so.3
#20 0x0111b3d2 in QObject::event(QEvent*) ()
   from /hda8/opt/qt-copy.20040531/lib/libqt-mt.so.3
#21 0x0114c13a in QWidget::event(QEvent*) ()
   from /hda8/opt/qt-copy.20040531/lib/libqt-mt.so.3
#22 0x010cbd21 in QApplication::internalNotify(QObject*, QEvent*) ()
   from /hda8/opt/qt-copy.20040531/lib/libqt-mt.so.3
#23 0x010cb3a4 in QApplication::notify(QObject*, QEvent*) ()
   from /hda8/opt/qt-copy.20040531/lib/libqt-mt.so.3
#24 0x004ff192 in KApplication::notify(QObject*, QEvent*) (this=0xbff115b0, 
    receiver=0x9ca5548, event=0xbff10c70) at kapplication.cpp:495
#25 0x0109b519 in QWidget::repaint(int, int, int, int, bool) ()
   from /hda8/opt/qt-copy.20040531/lib/libqt-mt.so.3
#26 0x0114d130 in QWidget::repaint(bool) ()
   from /hda8/opt/qt-copy.20040531/lib/libqt-mt.so.3
#27 0x011e61d6 in QListView::updateContents() ()
   from /hda8/opt/qt-copy.20040531/lib/libqt-mt.so.3
#28 0x013faf98 in QListView::qt_invoke(int, QUObject*) ()
   from /hda8/opt/qt-copy.20040531/lib/libqt-mt.so.3
#29 0x00290304 in KListView::qt_invoke(int, QUObject*) (this=0x9ca5038, 
    _id=69, _o=0xbff10e90) at klistview.moc:578
#30 0x033670eb in KonqBaseListViewWidget::qt_invoke(int, QUObject*) (
    this=0x9ca5038, _id=69, _o=0xbff10e90) at konq_listviewwidget.moc:179
#31 0x0336d303 in KonqTreeViewWidget::qt_invoke(int, QUObject*) (
    this=0x9ca5038, _id=69, _o=0xbff10e90) at konq_treeviewwidget.moc:118
#32 0x0111d6a2 in QObject::activate_signal(QConnectionList*, QUObject*) ()
   from /hda8/opt/qt-copy.20040531/lib/libqt-mt.so.3
#33 0x0111d504 in QObject::activate_signal(int) ()
   from /hda8/opt/qt-copy.20040531/lib/libqt-mt.so.3
#34 0x013ed4cc in QTimer::timeout() ()
   from /hda8/opt/qt-copy.20040531/lib/libqt-mt.so.3
#35 0x01139fef in QTimer::event(QEvent*) ()
   from /hda8/opt/qt-copy.20040531/lib/libqt-mt.so.3
#36 0x010cbd21 in QApplication::internalNotify(QObject*, QEvent*) ()
   from /hda8/opt/qt-copy.20040531/lib/libqt-mt.so.3
#37 0x010cb3a4 in QApplication::notify(QObject*, QEvent*) ()
   from /hda8/opt/qt-copy.20040531/lib/libqt-mt.so.3
#38 0x004ff192 in KApplication::notify(QObject*, QEvent*) (this=0xbff115b0, 
    receiver=0x9ca5f00, event=0xbff111e0) at kapplication.cpp:495
#39 0x010bce40 in QEventLoop::activateTimers() ()
   from /hda8/opt/qt-copy.20040531/lib/libqt-mt.so.3
#40 0x0107fb4e in QEventLoop::processEvents(unsigned) ()
   from /hda8/opt/qt-copy.20040531/lib/libqt-mt.so.3
#41 0x010db73b in QEventLoop::enterLoop() ()
   from /hda8/opt/qt-copy.20040531/lib/libqt-mt.so.3
#42 0x010db600 in QEventLoop::exec() ()
   from /hda8/opt/qt-copy.20040531/lib/libqt-mt.so.3
#43 0x010cbf20 in QApplication::exec() ()
   from /hda8/opt/qt-copy.20040531/lib/libqt-mt.so.3
#44 0x072e81d1 in kdemain (argc=2, argv=0x98fbd88) at konq_main.cc:204
#45 0x00864951 in kdeinitmain (argc=2, argv=0x98fbd88) at konqueror_dummy.cc:2
#46 0x0804e2a2 in launch (argc=2, _name=0x98fa62c "konqueror", 
    args=0x98fa63f "\001", cwd=0x0, envc=1, envs=0x98fa650 "", 
    reset_env=false, tty=0x0, avoid_loops=false, 
    startup_id_str=0x98fa654 "CC90001-A;1092491745;341842;3481_TIME1570051900")
    at kinit.cpp:599
#47 0x0804f5b9 in handle_launcher_request (sock=8) at kinit.cpp:1163
#48 0x0804fc82 in handle_requests (waitForPid=0) at kinit.cpp:1364
#49 0x0805114e in main (argc=3, argv=0xbff11c14, envp=0xbff11c24)
    at kinit.cpp:1817

kreatecd bt:
Using host libthread_db library "/lib/tls/libthread_db.so.1".
[Thread debugging using libthread_db enabled]
[New Thread -1085280128 (LWP 3034)]
[KCrash handler]
#4  0x08083986 in QString::length() const (this=0x90) at qstring.h:880
#5  0x080839a3 in QString::isEmpty() const (this=0x90) at qstring.h:886
#6  0x0068cc3b in KFileItem::pixmap(int, int) const (this=0x9dbfd68, _size=16, 
    _state=1) at kfileitem.cpp:461
#7  0x04cd1c83 in KonqListViewItem::setActive(bool) (this=0x9dffec8, 
    active=true) at konq_listviewitems.cc:158
#8  0x04ccb42c in KonqBaseListViewWidget::contentsMouseMoveEvent(QMouseEvent*)
    (this=0x9d46b40, e=0xbfeb2050) at konq_listviewwidget.cc:473
#9  0x0134d7e5 in QScrollView::viewportMouseMoveEvent(QMouseEvent*) ()
   from /hda8/opt/qt-copy/lib/libqt-mt.so.3
#10 0x0134d052 in QScrollView::eventFilter(QObject*, QEvent*) ()
   from /hda8/opt/qt-copy/lib/libqt-mt.so.3
#11 0x01321ee1 in QListView::eventFilter(QObject*, QEvent*) ()
   from /hda8/opt/qt-copy/lib/libqt-mt.so.3
#12 0x01256484 in QObject::activate_filters(QEvent*) ()
   from /hda8/opt/qt-copy/lib/libqt-mt.so.3
#13 0x012563d2 in QObject::event(QEvent*) ()
   from /hda8/opt/qt-copy/lib/libqt-mt.so.3
#14 0x0128713a in QWidget::event(QEvent*) ()
   from /hda8/opt/qt-copy/lib/libqt-mt.so.3
#15 0x01206d21 in QApplication::internalNotify(QObject*, QEvent*) ()
   from /hda8/opt/qt-copy/lib/libqt-mt.so.3
#16 0x01206488 in QApplication::notify(QObject*, QEvent*) ()
   from /hda8/opt/qt-copy/lib/libqt-mt.so.3
#17 0x00e28192 in KApplication::notify(QObject*, QEvent*) (this=0x9b584c0, 
    receiver=0x9d47108, event=0xbfeb2580) at kapplication.cpp:495
#18 0x011a8dd3 in QETWidget::translateMouseEvent(_XEvent const*) ()
   from /hda8/opt/qt-copy/lib/libqt-mt.so.3
#19 0x011a6cb1 in QApplication::x11ProcessEvent(_XEvent*) ()
   from /hda8/opt/qt-copy/lib/libqt-mt.so.3
#20 0x011bb08c in QEventLoop::processEvents(unsigned) ()
   from /hda8/opt/qt-copy/lib/libqt-mt.so.3
#21 0x0121673b in QEventLoop::enterLoop() ()
   from /hda8/opt/qt-copy/lib/libqt-mt.so.3
#22 0x01216600 in QEventLoop::exec() ()
   from /hda8/opt/qt-copy/lib/libqt-mt.so.3
#23 0x01206f20 in QApplication::exec() ()
   from /hda8/opt/qt-copy/lib/libqt-mt.so.3
#24 0x08081b29 in main (argc=1, argv=0xbfeb2b44) at startup.cpp:83
Comment 1 Waldo Bastian 2004-08-16 13:26:36 UTC
It's somewhat hard to reproduce (need to get the timing right), but I can reproduce it here indeed:

konqueror: [virtual void KonqTreeViewWidget::slotClear(const KURL&)] fish://bastian@localhost/home/bastian/cvs_83/kcontrol.backup1
kio (KDirWatch): WARNING: KDirWatch::removeDir can't handle '/home/bastian/cvs_83/kcontrol.backup1'
kio (KDirListerCache): listDir: Entry not in cache or reloaded: fish://bastian@localhost/home/bastian/cvs_83/kcontrol.backup1
KCrash: crashing... crashRecursionCounter = 2
KCrash: Application Name = konqueror path = <unknown> pid = 6250

#4  KFileItem::pixmap(int, int) const (this=0x869c3a8, _size=16, _state=1)
    at qstring.h:880
#5  0x4220093f in KonqListViewItem::setActive(bool) (this=0x86adf48)
    at konq_listviewitems.h:54
#6  0x421fa11c in KonqBaseListViewWidget::contentsMouseMoveEvent(QMouseEvent*)
    (this=0x836b828, e=0xbfffe4e0) at listview/konq_listviewwidget.cc:473
#7  0x40f76a27 in QScrollView::viewportMouseMoveEvent(QMouseEvent*) (
    this=0x836b828, e=0xbfffea00) at widgets/qscrollview.cpp:1782

Comment 2 Waldo Bastian 2004-08-16 14:20:43 UTC
Valgrind:

==19887== Invalid read of size 4
==19887==    at 0x405FCAAB: KFileItem::pixmap(int, int) const (kfileitem.cpp:461)
==19887==    by 0x4E04793E: KonqListViewItem::setActive(bool) (konq_listviewitems.h:54)
==19887==    by 0x4E04111B: KonqBaseListViewWidget::contentsMouseMoveEvent(QMouseEvent*) (konq_listviewwidget.cc:
==19887==    by 0x41191A26: QScrollView::viewportMouseMoveEvent(QMouseEvent*) (qscrollview.cpp:1782)
==19887==    by 0x41190FA9: QScrollView::eventFilter(QObject*, QEvent*) (qscrollview.cpp:1512)
==19887==    by 0x4115B424: QListView::eventFilter(QObject*, QEvent*) (qlistview.cpp:3833)
==19887==    by 0x4106AD2F: QObject::activate_filters(QEvent*) (qobject.cpp:902)
==19887==    by 0x4106ABA1: QObject::event(QEvent*) (qobject.cpp:735)
==19887==    by 0x410A53FE: QWidget::event(QEvent*) (qwidget.cpp:4653)
==19887==    by 0x4100A7BA: QApplication::internalNotify(QObject*, QEvent*) (qapplication.cpp:2620)
==19887==    by 0x41009F70: QApplication::notify(QObject*, QEvent*) (qapplication.cpp:2406)
==19887==    by 0x40B11E06: KApplication::notify(QObject*, QEvent*) (kapplication.cpp:495)
==19887==    by 0x40FA08FC: QApplication::sendSpontaneousEvent(QObject*, QEvent*) (qapplication.h:494)
==19887==    by 0x40F998FE: QETWidget::translateMouseEvent(_XEvent const*) (qapplication_x11.cpp:4257)
==19887==    by 0x40F9755E: QApplication::x11ProcessEvent(_XEvent*) (qapplication_x11.cpp:3408)
==19887==    by 0x40FB1B7B: QEventLoop::processEvents(unsigned) (qeventloop_x11.cpp:192)
==19887==    by 0x4101E981: QEventLoop::enterLoop() (qeventloop.cpp:198)
==19887==    by 0x4101E89D: QEventLoop::exec() (qeventloop.cpp:145)
==19887==    by 0x4100A93A: QApplication::exec() (qapplication.cpp:2743)
==19887==    by 0x4028315B: kdemain (konq_main.cc:204)
==19887==    by 0x80486A6: main (kdeinit_konqueror.cpp:2)
==19887==    by 0x418FFD3D: __libc_start_main (in /lib/libc.so.6)
==19887==    by 0x80485F0: ??? (start.S:102)
==19887==    Address 0x4B639BF8 is 120 bytes inside a block of size 124 free'd
==19887==    at 0x4002A0B3: __builtin_delete (vg_replace_malloc.c:244)
==19887==    by 0x4002A0D1: operator delete(void*) (vg_replace_malloc.c:253)
==19887==    by 0x405FB93E: KFileItem::~KFileItem() (kfileitem.cpp:169)
==19887==    by 0x4029EF8D: QPtrList<KFileItem>::deleteItem(void*) (qptrlist.h:150)
==19887==    by 0x4133E05E: QGList::clear() (qglist.cpp:701)
==19887==    by 0x4029EEA7: QPtrList<KFileItem>::~QPtrList() (qptrlist.h:93)
==19887==    by 0x4060413E: KDirListerCache::forgetDirs(KDirLister*, KURL const&, bool) (kdebug.h:231)
==19887==    by 0x40601078: KDirListerCache::listDir(KDirLister*, KURL const&, bool, bool) (kdirlister.cpp:123)
==19887==    by 0x4060F407: KDirLister::openURL(KURL const&, bool, bool) (kdirlister.cpp:1588)
==19887==    by 0x4E04B2C7: KonqTreeViewWidget::openSubFolder(KonqListViewDir*, bool) (kfileitem.h:46)
==19887==    by 0x4E04C1B0: KonqListViewDir::open(bool, bool) (konq_treeviewitem.cc:66)
==19887==    by 0x4E04C132: KonqListViewDir::setOpen(bool) (konq_treeviewitem.cc:54)
==19887==    by 0x4116515D: QListView::setOpen(QListViewItem*, bool) (qlistview.cpp:6834)
==19887==    by 0x4115BDD7: QListView::contentsMousePressEventEx(QMouseEvent*) (qlistview.cpp:4270)
==19887==    by 0x4115B7D2: QListView::contentsMousePressEvent(QMouseEvent*) (qlistview.cpp:4201)
==19887==    by 0x408B6424: KListView::contentsMousePressEvent(QMouseEvent*) (klistview.cpp:778)
==19887==    by 0x4E040E58: KonqBaseListViewWidget::contentsMousePressEvent(QMouseEvent*) (konq_listviewwidget.cc
==19887==    by 0x411917B0: QScrollView::viewportMousePressEvent(QMouseEvent*) (qscrollview.cpp:1731)
==19887==    by 0x41190EF5: QScrollView::eventFilter(QObject*, QEvent*) (qscrollview.cpp:1497)
==19887==    by 0x4115B424: QListView::eventFilter(QObject*, QEvent*) (qlistview.cpp:3833)
==19887==    by 0x4106AD2F: QObject::activate_filters(QEvent*) (qobject.cpp:902)
==19887==    by 0x4106ABA1: QObject::event(QEvent*) (qobject.cpp:735)
==19887==    by 0x410A53FE: QWidget::event(QEvent*) (qwidget.cpp:4653)
Comment 3 Waldo Bastian 2004-08-16 16:31:57 UTC
CVS commit by waba: 

Don't keep listview items around that are no longer valid. (BR87204)
CCMAIL: 87204-done@bugs.kde.org


  M +5 -0      konq_treeviewwidget.cc   1.55


--- kdebase/konqueror/listview/konq_treeviewwidget.cc  #1.54:1.55
@@ -140,4 +140,9 @@ void KonqTreeViewWidget::clearSubDir( co
          }
       }
+      
+      // Delete all child items, their file-items are no longer valid
+      QListViewItem* child;
+      while((child = item->firstChild()))
+         delete child;
    }
 }


Comment 4 2005-03-26 23:47:56 UTC
this patch isnt applyed in cvs 3_4_BRANCH, why?