Bug 177387 - Clicking a "non-listed" folder in a file dialog crashes the application (!dirData.listersCurrentlyListing.contains(lister) in kdirlister.cpp:235)
Summary: Clicking a "non-listed" folder in a file dialog crashes the application (!dir...
Status: RESOLVED FIXED
Alias: None
Product: kfile
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
: 179827 180152 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-12-10 14:43 UTC by Dario Andres
Modified: 2009-01-10 18:29 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dario Andres 2008-12-10 14:43:31 UTC
Version:           SVN ver (kdelibs 895205) (using Devel)
OS:                Linux
Installed from:    Compiled sources

I have experienced this bug when saving a screenshot in KSnapshot, or even when saving a bug report in KCrash.
I'm using KDE4.2svn (kdelibs 895205 , today trunk), in ArchLinux x86_64

In the Save file dialog, if you click a folder (to enter it and then save the file inside it), the application crashes.

-------------

Backtrace when trying to save a screenshot from KSnapshot, clicking "Root" in places and then clicking in /tmp

Application: KSnapshot (ksnapshot), signal SIGABRT
0x00007f166322cea0 in __nanosleep_nocancel () from /lib/libc.so.6

Thread 1 (Thread 0x7f166763d750 (LWP 1024)):
[KCrash Handler]
#5  0x00007f16631c00d5 in raise () from /lib/libc.so.6
#6  0x00007f16631c15f3 in abort () from /lib/libc.so.6
#7  0x00007f1664e3e0a5 in qt_message_output () from /usr/lib/libQtCore.so.4
#8  0x00007f1664e3e1c7 in qFatal () from /usr/lib/libQtCore.so.4
#9  0x00007f16671ad886 in KDirListerCache::listDir (this=0x143da50, lister=0x1625e90, _u=<value optimized out>, _keep=<value optimized out>, _reload=false)
    at /home/kde-devel/kde/src/KDE/kdelibs/kio/kio/kdirlister.cpp:235
#10 0x00007f165cbb43d6 in KDirOperator::Private::openUrl (this=0x16265c0, url=@0x400, flags=<value optimized out>) at /home/kde-devel/kde/src/KDE/kdelibs/kfile/kdiroperator.cpp:1112
#11 0x00007f165cbc0102 in KDirOperator::setUrl (this=0x16ab850, _newurl=<value optimized out>, clearforward=192) at /home/kde-devel/kde/src/KDE/kdelibs/kfile/kdiroperator.cpp:1093
#12 0x00007f165cbb44a6 in KDirOperator::selectDir (this=0x16ab850, item=<value optimized out>) at /home/kde-devel/kde/src/KDE/kdelibs/kfile/kdiroperator.cpp:1669
#13 0x00007f165cbb4350 in KDirOperator::Private::_k_slotActivated (this=0x16265c0, index=<value optimized out>) at /home/kde-devel/kde/src/KDE/kdelibs/kfile/kdiroperator.cpp:2331
#14 0x00007f165cbbf9ab in KDirOperator::qt_metacall (this=0x16ab850, _c=QMetaObject::InvokeMetaMethod, _id=<value optimized out>, _a=0x7fff6f777310)
    at /home/kde-devel/kde/build/KDE/kdelibs/kfile/kdiroperator.moc:241
#15 0x00007f1664f27d00 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#16 0x00007f166421eea5 in QAbstractItemView::activated () from /usr/lib/libQtGui.so.4
#17 0x00007f166422b5a4 in QAbstractItemView::mouseReleaseEvent () from /usr/lib/libQtGui.so.4
#18 0x00007f1663e6b59c in QWidget::event () from /usr/lib/libQtGui.so.4
#19 0x00007f166422bd0d in QAbstractItemView::viewportEvent () from /usr/lib/libQtGui.so.4
#20 0x00007f166425d3ec in QTreeView::viewportEvent () from /usr/lib/libQtGui.so.4
#21 0x00007f1664f156c8 in QCoreApplicationPrivate::sendThroughObjectEventFilters () from /usr/lib/libQtCore.so.4
#22 0x00007f1663e1e4ac in QApplicationPrivate::notify_helper () from /usr/lib/libQtGui.so.4
#23 0x00007f1663e250ee in QApplication::notify () from /usr/lib/libQtGui.so.4
#24 0x00007f1665d2500b in KApplication::notify (this=0x7fff6f77a5e0, receiver=0x17114b0, event=0x7fff6f778190) at /home/kde-devel/kde/src/KDE/kdelibs/kdeui/kernel/kapplication.cpp:307
#25 0x00007f1664f163d1 in QCoreApplication::notifyInternal () from /usr/lib/libQtCore.so.4
#26 0x00007f1663e26498 in QApplicationPrivate::sendMouseEvent () from /usr/lib/libQtGui.so.4
#27 0x00007f1663e7cb1c in ?? () from /usr/lib/libQtGui.so.4
#28 0x00007f1663e7bc99 in QApplication::x11ProcessEvent () from /usr/lib/libQtGui.so.4
#29 0x00007f1663e9f744 in ?? () from /usr/lib/libQtGui.so.4
#30 0x00007f1660136aa2 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#31 0x00007f166013a21d in g_main_context_iterate () from /usr/lib/libglib-2.0.so.0
#32 0x00007f166013a3db in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#33 0x00007f1664f3a89f in QEventDispatcherGlib::processEvents () from /usr/lib/libQtCore.so.4
#34 0x00007f1663e9efff in ?? () from /usr/lib/libQtGui.so.4
#35 0x00007f1664f14d42 in QEventLoop::processEvents () from /usr/lib/libQtCore.so.4
#36 0x00007f1664f14ed5 in QEventLoop::exec () from /usr/lib/libQtCore.so.4
#37 0x00007f16641d9a6f in QDialog::exec () from /usr/lib/libQtGui.so.4
#38 0x000000000040feb4 in KSnapshot::slotSaveAs (this=0x106b230) at /home/kde-devel/kde/src/KDE/kdegraphics/ksnapshot/ksnapshot.cpp:236
#39 0x000000000041130d in KSnapshot::qt_metacall (this=0x106b230, _c=QMetaObject::InvokeMetaMethod, _id=0, _a=0x7fff6f779040) at /home/kde-devel/kde/build/KDE/kdegraphics/ksnapshot/ksnapshot.moc:209
#40 0x00007f1664f27d00 in QMetaObject::activate () from /usr/lib/libQtCore.so.4
#41 0x00007f16643239b7 in QAbstractButton::clicked () from /usr/lib/libQtGui.so.4
#42 0x00007f16640e3e7b in ?? () from /usr/lib/libQtGui.so.4
#43 0x00007f16640e4c52 in ?? () from /usr/lib/libQtGui.so.4
#44 0x00007f16640e4e85 in QAbstractButton::mouseReleaseEvent () from /usr/lib/libQtGui.so.4
#45 0x00007f1663e6b59c in QWidget::event () from /usr/lib/libQtGui.so.4
#46 0x00007f1663e1e4dd in QApplicationPrivate::notify_helper () from /usr/lib/libQtGui.so.4
#47 0x00007f1663e250ee in QApplication::notify () from /usr/lib/libQtGui.so.4
#48 0x00007f1665d2500b in KApplication::notify (this=0x7fff6f77a5e0, receiver=0x113bc40, event=0x7fff6f779960) at /home/kde-devel/kde/src/KDE/kdelibs/kdeui/kernel/kapplication.cpp:307
#49 0x00007f1664f163d1 in QCoreApplication::notifyInternal () from /usr/lib/libQtCore.so.4
#50 0x00007f1663e26498 in QApplicationPrivate::sendMouseEvent () from /usr/lib/libQtGui.so.4
#51 0x00007f1663e7cb1c in ?? () from /usr/lib/libQtGui.so.4
#52 0x00007f1663e7bc99 in QApplication::x11ProcessEvent () from /usr/lib/libQtGui.so.4
#53 0x00007f1663e9f744 in ?? () from /usr/lib/libQtGui.so.4
#54 0x00007f1660136aa2 in g_main_context_dispatch () from /usr/lib/libglib-2.0.so.0
#55 0x00007f166013a21d in g_main_context_iterate () from /usr/lib/libglib-2.0.so.0
#56 0x00007f166013a3db in g_main_context_iteration () from /usr/lib/libglib-2.0.so.0
#57 0x00007f1664f3a89f in QEventDispatcherGlib::processEvents () from /usr/lib/libQtCore.so.4
#58 0x00007f1663e9efff in ?? () from /usr/lib/libQtGui.so.4
#59 0x00007f1664f14d42 in QEventLoop::processEvents () from /usr/lib/libQtCore.so.4
#60 0x00007f1664f14ed5 in QEventLoop::exec () from /usr/lib/libQtCore.so.4
#61 0x00007f1664f17025 in QCoreApplication::exec () from /usr/lib/libQtCore.so.4
#62 0x000000000040e45c in main (argc=3, argv=0x7fff6f77aaa8) at /home/kde-devel/kde/src/KDE/kdegraphics/ksnapshot/main.cpp:83

---------

If you want more information just ask me.
Comment 1 Dario Andres 2008-12-10 14:51:54 UTC
New info, this doesn't happend when browsing in $HOME folders.
This also doesn't happen when entering "/tmp" in the Location text edit
This seems to happen only when you haven't browsed at first in your $HOME folders (in the same filedialog "instance"), and you go directly to some Root folder (like /bin or /tmp. Going to /home works without crashing)

The assert is: !dirData.listersCurrentlyListing.contains(lister) in kdirlister.cpp:235 

(it makes sense that /bin or /tmp aren't currenty listened, but /home does)
Comment 2 Frank Reininghaus 2008-12-10 22:40:15 UTC
I've seen the same thing happen in Kate's file open dialog if I open a file which is a few levels deep in the home directory via "kate <FILE>", then click "Open" in the toolbar, then go up a few levels and enter another directory. How many levels I need to go up seems to differ depending on the opened file and its location in the directory structure. 

A reproducible way to crash Kate for me is:

1. "cd" to the kdelibs/kio/kio directory of the KDE source tree
2. "kate kdirlister.cpp"
3. Click "Open" in toolbar
4. Go up 2 levels, click the "cmake" directory

It crashes with the same assert then (trunk rev. 895445; 4.1.3 does not crash).
Comment 3 David Faure 2008-12-15 18:21:12 UTC
SVN commit 897298 by dfaure:

Fix assert due to reentrancy in KDirLister (openUrl -> stop -> emit canceled -> KDirOperator would then do
 slotLoadingFinished -> setCurrentItem -> expandToUrl -> listDir).
Just like r891975, people don't expect canceled to be emitted for internal reasons, only when actually canceling the job from the outside.

This assert was added in 891960, so it also fixes the ASSERT: "!listersCurrentlyHolding.contains(kdl)" that sebas was getting in the file dialog.

BUG: 177387


 M  +31 -29    kio/kdirlister.cpp  
 M  +3 -3      kio/kdirlister_p.h  
 M  +48 -2     tests/kdirlistertest.cpp  
 M  +1 -0      tests/kdirlistertest.h  


WebSVN link: http://websvn.kde.org/?view=rev&revision=897298
Comment 4 Dario Andres 2009-01-09 18:08:32 UTC
*** Bug 180152 has been marked as a duplicate of this bug. ***
Comment 5 Dario Andres 2009-01-10 18:29:05 UTC
*** Bug 179827 has been marked as a duplicate of this bug. ***