Patch to fix crash in kdirmodel

David Faure faure at kde.org
Mon Feb 19 23:27:06 GMT 2007


On Monday 19 February 2007, Andreas Pakulat wrote:
> Hi,
> 
> the attached patch fixes a crash in kdirmodel if a view calls fetchMore
> more than once with the same index. This happens if one puts a simple
> QListView on top of a kdirmodel and then navigates into a directory with
> many items so that scrollbars appear. When you navigate to the same dir
> the second time you can crash the app by scrolling. The reason is that
> QAbstractItemView's implementations of *ScrollBarValueChanged() call
> fetchMore() without first running canFetchMore.
Ah. Not much point in canFetchMore then :/

> The downside of the patch is the memory added by 1 bool for each item
> in the model. So I'm not sure if we should do that or just depend on
> sane view implementations that first check with canFetchMore before
> fetching more.

OK for the bool, but it shouldn't be in KDirModelNode, it should be in KDirModelDirNode,
the subclass for directories. Can you adjust the patch accordingly?

-- 
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).




More information about the kde-core-devel mailing list