<table><tr><td style="">feverfew added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D28535">View Revision</a></tr></table><br /><div><div><p>If you want to, feel free, I'm a bit tight on time. But I will say this. the whole <tt style="background: #ebebeb; font-size: 13px;">getDevice()</tt> function confuses me. I'm not entirely sure why this <tt style="background: #ebebeb; font-size: 13px;">if</tt> check is necessary at all. The lifetime of devices and its children (i.e storage) should be managed by the KMTPD daemon AFAICT. A device shouldn't be trying to re-open itself anywhere IMO. To me the getDevice() function should simply be a simple return to avoid this NULL issue happening. Even if a device doesn't exist anymore, no segfaults should happen when passing an "invalid" <tt style="background: #ebebeb; font-size: 13px;">LIBMTP_device_T</tt> to any other <tt style="background: #ebebeb; font-size: 13px;">LIBMTP</tt> function?</p>
<p>So to be succinct, the only correct fix here is to change <tt style="background: #ebebeb; font-size: 13px;">getDevice()</tt> to <tt style="background: #ebebeb; font-size: 13px;">return m_mtpdevice</tt>?</p></div></div><br /><div><strong>REPOSITORY</strong><div><div>R320 KIO Extras</div></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D28535">https://phabricator.kde.org/D28535</a></div></div><br /><div><strong>To: </strong>feverfew, akrutzler, dfaure, elvisangelaccio<br /><strong>Cc: </strong>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<br /></div>