Nasty bug in KFilesTreeBranch

Andras Mantia amantia at kde.org
Sun Nov 21 18:26:00 GMT 2004


Hi,

 It took me quite some time to debug a Quanta bug, which turned to be a 
bug in  KFilesTreeBranch. It happens only in certain cases, if you 
delete a directory and request some new operation having the same URL 
as the deleted directory. Yes, this is possible, for example in Quanta 
using the following scheme:
- create /home/foo
- create a new project in /home/foo, while the new project wizard is 
running, delete /home/foo in a console. This isn't a problem, as it 
will be recreated
- repeat step 2 and you will see a crash.

The problem is that when the directory deletion is detected in 
KFilesTreeBranch, the item is deleted, but the item might be the last 
queried item in findTVIByURL. This is a problem, as there is an 
optimization in findTVIByURL to return the last found item, if the URL 
of the current query is the same as the URL of the last query.
As you see this item might not be valid in certain cases, leading later 
to strange crashes (log & BT attached to see it). 

The solution:
A) - the patch
B) - get rid of the "optimization"

As I see the patch causes less slowdown, so if nobody objects, I will 
commit (to BRANCH as well).

Andras

-- 
Quanta Plus developer - http://quanta.sourceforge.net
K Desktop Environment - http://www.kde.org
-------------- next part --------------
Using host libthread_db library "/lib/libthread_db.so.1".
[Thread debugging using libthread_db enabled]
[New Thread 16384 (LWP 20825)]
[KCrash handler]
#5  0x40ab537b in KFileItem::pixmap (this=0xe0, _size=16, _state=0)
    at /data/development/sources/kde-head/kdelibs/kio/kio/kfileitem.cpp:484
#6  0x40b8d923 in KFileTreeBranch::slotRefreshItems (this=0x86786b8,
    list=@0x8c0aed8)
    at /data/development/sources/kde-head/kdelibs/kio/kfile/kfiletreebranch.cpp:146
#7  0x40b8f627 in KFileTreeBranch::qt_invoke (this=0x86786b8, _id=11,
    _o=0xbfffe390) at kfiletreebranch.moc:209
#8  0x081a5152 in BaseTreeBranch::qt_invoke (this=0x86786b8, _id=11,
    _o=0xbfffe390) at basetreeview.moc:87
#9  0x4144ba2c in QObject::activate_signal ()
   from /usr/lib/qt-copy-3.3/lib/libqt-mt.so.3
#10 0x40ac2d03 in KDirLister::refreshItems (this=0x86786b8, t0=@0x8c0aed8)
    at kdirlister.moc:351
#11 0x40ac1983 in KDirLister::emitItems (this=0x86786b8)
    at /data/development/sources/kde-head/kdelibs/kio/kio/kdirlister.cpp:2045
#12 0x40abe647 in KDirListerCache::slotUpdateResult (this=0x8671a50,
    j=0x8a02c50)
    at /data/development/sources/kde-head/kdelibs/kio/kio/kdirlister.cpp:1350
#13 0x40ac3d01 in KDirListerCache::qt_invoke (this=0x8671a50, _id=10,
    _o=0xbfffe610) at kdirlister_p.moc:135
#14 0x4144ba2c in QObject::activate_signal ()
   from /usr/lib/qt-copy-3.3/lib/libqt-mt.so.3
#15 0x40a2118c in KIO::Job::result (this=0x8a02c50, t0=0x8a02c50)
    at jobclasses.moc:156
#16 0x40a0cc33 in KIO::Job::emitResult (this=0x8a02c50)
    at /data/development/sources/kde-head/kdelibs/kio/kio/job.cpp:217
#17 0x40a0e1f2 in KIO::SimpleJob::slotFinished (this=0x8a02c50)
    at /data/development/sources/kde-head/kdelibs/kio/kio/job.cpp:536
#18 0x40a1556e in KIO::ListJob::slotFinished (this=0x8a02c50)
    at /data/development/sources/kde-head/kdelibs/kio/kio/job.cpp:2029
#19 0x40a24fc8 in KIO::ListJob::qt_invoke (this=0x8a02c50, _id=16,
    _o=0xbfffe880) at jobclasses.moc:1713
#20 0x4144ba2c in QObject::activate_signal ()
   from /usr/lib/qt-copy-3.3/lib/libqt-mt.so.3
#21 0x4144c0cb in QObject::activate_signal ()
   from /usr/lib/qt-copy-3.3/lib/libqt-mt.so.3
#22 0x409ff8d3 in KIO::SlaveInterface::finished (this=0x854b200)
    at slaveinterface.moc:226
#23 0x409fdeaf in KIO::SlaveInterface::dispatch (this=0x854b200, _cmd=104,
    rawdata=@0xbfffea50)
    at /data/development/sources/kde-head/kdelibs/kio/kio/slaveinterface.cpp:237
#24 0x409fdb18 in KIO::SlaveInterface::dispatch (this=0x854b200)
    at /data/development/sources/kde-head/kdelibs/kio/kio/slaveinterface.cpp:173
#25 0x409fb585 in KIO::Slave::gotInput (this=0x854b200)
    at /data/development/sources/kde-head/kdelibs/kio/kio/slave.cpp:300
#26 0x409fd003 in KIO::Slave::qt_invoke (this=0x854b200, _id=4, _o=0xbfffeb90)
    at slave.moc:113
#27 0x4144ba2c in QObject::activate_signal ()
   from /usr/lib/qt-copy-3.3/lib/libqt-mt.so.3
#28 0x4144bf8d in QObject::activate_signal ()
   from /usr/lib/qt-copy-3.3/lib/libqt-mt.so.3
#29 0x41758698 in QSocketNotifier::activated ()
   from /usr/lib/qt-copy-3.3/lib/libqt-mt.so.3
#30 0x41468a01 in QSocketNotifier::event ()
   from /usr/lib/qt-copy-3.3/lib/libqt-mt.so.3
#31 0x413eeb64 in QApplication::internalNotify ()
   from /usr/lib/qt-copy-3.3/lib/libqt-mt.so.3
#32 0x413f0462 in QApplication::notify ()
   from /usr/lib/qt-copy-3.3/lib/libqt-mt.so.3
#33 0x40fa7307 in KApplication::notify () from /opt/kde-cvs/lib/libkdecore.so.4
#34 0x413e34ee in QEventLoop::activateSocketNotifiers ()
   from /usr/lib/qt-copy-3.3/lib/libqt-mt.so.3
#35 0x413a1e33 in QEventLoop::processEvents ()
   from /usr/lib/qt-copy-3.3/lib/libqt-mt.so.3
#36 0x41404caa in QEventLoop::enterLoop ()
   from /usr/lib/qt-copy-3.3/lib/libqt-mt.so.3
#37 0x41404b04 in QEventLoop::exec ()
   from /usr/lib/qt-copy-3.3/lib/libqt-mt.so.3
#38 0x413f0350 in QApplication::exec ()
   from /usr/lib/qt-copy-3.3/lib/libqt-mt.so.3
#39 0x080a68bd in main (argc=1, argv=0xbffff294)
    at /home/andris/development/sources/kde-head/kdewebdev/quanta/src/main.cpp:208
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lastFound.diff
Type: text/x-diff
Size: 618 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20041121/c5c52a86/attachment.diff>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: lastFound.log
Type: text/x-log
Size: 4295 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20041121/c5c52a86/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20041121/c5c52a86/attachment.sig>


More information about the kde-core-devel mailing list