fvogt added a comment.
In D28535#640656 <https://phabricator.kde.org/D28535#640656>, @anthonyfieroni wrote: > You're right about bug report, but it can fail in any other place, just in particular version it happen in `updateStorageInfo` Can we cache `getDevice` in m_device (in constructor) then use it everywhere. I think libmtp has guard against disconnected device and will not crash. `MTPDevice` already does that. If `getDevice()` returns nullptr, this means that `MTPDevice::getDevice()` returns nullptr. This can only happen if `m_mtpdevice` is nullptr, which will crash in `MTPDevice::~MTPDevice` sooner or later anyway. So this patch will at most just delay the crash. AFAICT `MTPDevice` is supposed to be destroyed in `KMTPd::deviceRemoved` on disconnection, but this is obviously racy. REPOSITORY R320 KIO Extras REVISION DETAIL https://phabricator.kde.org/D28535 To: feverfew, akrutzler, dfaure, elvisangelaccio Cc: anthonyfieroni, kde-frameworks-devel, fvogt, kfm-devel, ngraham, nikolaik, pberestov, iasensio, fprice, LeGast00n, cblack, fbampaloukas, alexde, GB_2, Codezela, feverfew, meven, michaelh, spoorun, navarromorales, firef, andrebarros, bruns, emmanuelp, mikesomov