D20024: Fixes crash when hiding devices

David Hallas noreply at phabricator.kde.org
Mon Apr 1 14:27:58 BST 2019


hallas added inline comments.

INLINE COMMENTS

> elvisangelaccio wrote in kstandarditem.cpp:117-118
> While this change fixes the crash, I consider it a workaround as it's relying on an implementation detail of the model.
> 
> It doesn't fix the actual problem, which I think is in `PlacesItemModel::onSourceModelDataChanged()`. Can you try to delay the `removeItem()` call (at line 569)  using a `QTimer::singleShot()` ?
> 
> Basically, we should do what dolphin used to do with the old PlacesItemModel implementation:
> 
>   void PlacesItemModel::onItemChanged(int index, const QSet<QByteArray>& changedRoles)
>   {
>       ...
>   
>       if (changedRoles.contains("isHidden")) {
>           if (!m_hiddenItemsShown && changedItem->isHidden()) {
>               m_hiddenItemToRemove = index;
>               QTimer::singleShot(0, this, static_cast<void (PlacesItemModel::*)()>(&PlacesItemModel::hideItem));
>           }
>       }
>   }
> 
> (commit da6f8fe0862585287 <https://phabricator.kde.org/R318:da6f8fe0862585287153f0d90e19eab0b34bfbef> dropped the QTimer and probably introduced this crash).

Yeah, I tend to agree :D But I was actually thinking if it would be nicer if the items were `QObjects`, and then we could use `deleteLater`? Using a timer still kind of relies on implementation detail knowledge...

REPOSITORY
  R318 Dolphin

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

To: hallas, #dolphin, elvisangelaccio
Cc: ngraham, kfm-devel, alexde, feverfew, meven, spoorun, navarromorales, firef, andrebarros, emmanuelp, mikesomov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.kde.org/mailman/private/kfm-devel/attachments/20190401/797ea687/attachment.htm>


More information about the kfm-devel mailing list