D24723: Fix slideshow crashing in invalidate()

Kai Uwe Broulik noreply at phabricator.kde.org
Thu Oct 17 17:43:16 BST 2019


broulik added inline comments.

INLINE COMMENTS

> slidefiltermodel.cpp:51
> +    if(sourceModel) {
> +        connect(sourceModel, &QAbstractItemModel::rowsInserted, this, &SlideFilterModel::invalidate);
> +        connect(sourceModel, &QAbstractItemModel::rowsRemoved, this, &SlideFilterModel::invalidate);

Perhaps only `invalidate` if order is actually set to random?

I am actually not sure we need to invalidate at all when inserting items, unless you want to shuffle every time that happens? Perhaps all we need to do is shrink/grow the random vector when new items are added?

> slidefiltermodel.cpp:121
> +{
> +    m_randomOrder.resize(sourceModel()->rowCount());
> +    std::iota(m_randomOrder.begin(), m_randomOrder.end(), 0);

Can `sourceModel()` be null here?

REPOSITORY
  R120 Plasma Workspace

REVISION DETAIL
  https://phabricator.kde.org/D24723

To: davidre, #plasma
Cc: broulik, plasma-devel, LeGast00n, The-Feren-OS-Dev, jraleigh, fbampaloukas, GB_2, ragreen, ZrenBot, ngraham, alexeymin, himcesjf, lesliezhai, ali-mohamed, jensreuterberg, abetts, sebas, apol, ahiemstra, mart
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/plasma-devel/attachments/20191017/ba74bd5a/attachment.html>


More information about the Plasma-devel mailing list