D14158: Avoid a kio-mtp crash when trying to add a blocked device to the device cache

2018-07-21 Thread Jaime Torres Amate
This revision was automatically updated to reflect the committed changes.
Closed by commit R320:0cc17f0c1b91: Avoid a kio-mtp crash when trying to add a 
blocked device to the device cache (authored by jtamate).

REPOSITORY
  R320 KIO Extras

CHANGES SINCE LAST UPDATE
  https://phabricator.kde.org/D14158?vs=37869=38164

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

AFFECTED FILES
  mtp/devicecache.cpp

To: jtamate, #frameworks, elvisangelaccio
Cc: broulik


D14158: Avoid a kio-mtp crash when trying to add a blocked device to the device cache

2018-07-21 Thread Elvis Angelaccio
elvisangelaccio accepted this revision.
This revision is now accepted and ready to land.

REPOSITORY
  R320 KIO Extras

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

To: jtamate, #frameworks, elvisangelaccio
Cc: broulik


D14158: Avoid a kio-mtp crash when trying to add a blocked device to the device cache

2018-07-16 Thread Kai Uwe Broulik
broulik added a comment.


  Should this show an error to the user? I could also imagine this interfering 
with thumbnail generation when viewing the device

REPOSITORY
  R320 KIO Extras

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

To: jtamate, #frameworks
Cc: broulik


D14158: Avoid a kio-mtp crash when trying to add a blocked device to the device cache

2018-07-16 Thread Jaime Torres Amate
jtamate created this revision.
jtamate added a reviewer: Frameworks.
jtamate requested review of this revision.

REVISION SUMMARY
  When the device is blocked, for example by amarok mtp plugin, the result of 
LIBMTP_Open_Raw_Device_Uncached(rawDevice) is nullptr and 
  LIBMTP_Get_Friendlyname(nullptr) crashes.
  
  Avoid to create a cache for a device that can't be opened.
  
  CCBUG: 396527

TEST PLAN
  With Amarok started and its mtp plugin enabled, plug in an android device.
  Try to open it with dolphin, always the same kio backtrace:
  
==13233== Invalid read of size 8
==13233==at 0x1087ABCE: LIBMTP_Get_Friendlyname (in 
/usr/lib64/libmtp.so.9.4.0)
==13233==by 0x105EE67C: 
CachedDevice::CachedDevice(LIBMTP_mtpdevice_struct*, LIBMTP_raw_device_struct*, 
QString, int) (devicecache.cpp:44)
==13233==by 0x105F0A30: DeviceCache::checkDevice(Solid::Device) 
(devicecache.cpp:150)
==13233==by 0x105F1517: DeviceCache::DeviceCache(int, QObject*) 
(devicecache.cpp:94)
==13233==by 0x105F2FC1: MTPSlave::MTPSlave(QByteArray const&, 
QByteArray const&) (kio_mtp.cpp:70)
==13233==by 0x105F8BF9: kdemain (kio_mtp.cpp:54)
==13233==by 0x4016CC: main (kioslave.cpp:130)
==13233==  Address 0x8 is not stack'd, malloc'd or (recently) free'd
  
  And in dolphin, the message: MTP died unexpectedly
  
  After, the message: The file or folder 
udi=/org/kde/solid/udev/sys/devices/pci:00/:00:14.0/usb1/1-1 does not 
exist.

REPOSITORY
  R320 KIO Extras

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

AFFECTED FILES
  mtp/devicecache.cpp

To: jtamate, #frameworks