Bug 176555 - patch - dolphin crashes when pressing * in tree view
Summary: patch - dolphin crashes when pressing * in tree view
Status: RESOLVED FIXED
Alias: None
Product: kio
Classification: Unmaintained
Component: general (show other bugs)
Version: 4.1
Platform: Compiled Sources Linux
: NOR crash
Target Milestone: ---
Assignee: David Faure
URL:
Keywords:
: 34399 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-11-30 17:10 UTC by Sergio Martins
Modified: 2008-12-02 15:41 UTC (History)
1 user (show)

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


Attachments
patch (835 bytes, patch)
2008-11-30 17:13 UTC, Sergio Martins
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Sergio Martins 2008-11-30 17:10:21 UTC
Version:            (using Devel)
OS:                Linux
Installed from:    Compiled sources

Steps to reproduce:
1. In dolphin choose Details view
2. Go to options and make sure you have "Expanded Folders" selected

Now that you have a tree view, select a folder, and press * a couple of times (* make all the nodes expand) until dolphin crashes.

The problem is in kdelibs/kio/kio/kdirmodel.cpp inside KDirModel::rowCount

This cast isn't safe:
KDirModelDirNode* parentNode = static_cast<KDirModelDirNode *>(d->nodeForIndex(parent))

because we can't be sure if the node is a KDirModelDirNode, sometimes it isn't.


Here's a patch, please review it since i'm still a newbie in this kde qt stuff :D
Comment 1 Sergio Martins 2008-11-30 17:13:11 UTC
Created attachment 28952 [details]
patch
Comment 2 David Faure 2008-12-02 15:12:06 UTC
Very good analysis of the problem.
Your suggested patch calls nodeForIndex 3 times though, I'll change it to only call it once. Thanks.
Comment 3 David Faure 2008-12-02 15:36:01 UTC
SVN commit 891650 by dfaure:

Fix crash when rowCount is called on a file, like when typing '*' in a treeview.
BUG: 176555


 M  +5 -1      kio/kdirmodel.cpp  
 M  +4 -0      tests/kdirmodeltest.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=891650
Comment 4 Peter Penz 2008-12-02 15:41:35 UTC
*** Bug 34399 has been marked as a duplicate of this bug. ***