mtp

Merge lp:~cyphermox/mtp/recursive-delete-fix into lp:mtp

Proposed by Mathieu Trudel-Lapierre
Status: Merged
Approved by: Ricardo Salveti
Approved revision: 62
Merged at revision: 62
Proposed branch: lp:~cyphermox/mtp/recursive-delete-fix
Merge into: lp:mtp
Diff against target: 25 lines (+7/-1)
1 file modified
server/UbuntuMtpDatabase.h (+7/-1)
To merge this branch: bzr merge lp:~cyphermox/mtp/recursive-delete-fix
Reviewer Review Type Date Requested Status
Ricardo Salveti (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+247646@code.launchpad.net

Commit message

Fix crash when recursively deleting directories; due to the concurrency between inotify notifications from filesystem changes and the delete method already removing items from the database.

Description of the change

Fix crash when recursively deleting directories; due to the concurrency between inotify notifications from filesystem changes and the delete method already removing items from the database.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Ricardo Salveti (rsalveti) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'server/UbuntuMtpDatabase.h'
--- server/UbuntuMtpDatabase.h 2014-09-08 19:27:06 +0000
+++ server/UbuntuMtpDatabase.h 2015-01-26 20:06:32 +0000
@@ -252,6 +252,7 @@
252 const char* cdata = processed + asio::buffer_cast<const char*>(buf.data());252 const char* cdata = processed + asio::buffer_cast<const char*>(buf.data());
253 const inotify_event* ievent = reinterpret_cast<const inotify_event*>(cdata);253 const inotify_event* ievent = reinterpret_cast<const inotify_event*>(cdata);
254 MtpObjectHandle parent;254 MtpObjectHandle parent;
255 path p;
255 256
256 processed += sizeof(inotify_event) + ievent->len;257 processed += sizeof(inotify_event) + ievent->len;
257 258
@@ -262,7 +263,12 @@
262 }263 }
263 }264 }
264265
265 path p(db.at(parent).path + "/" + ievent->name);266 try {
267 p = path(db.at(parent).path + "/" + ievent->name);
268 } catch (...) {
269 PLOG(WARNING) << "Could not find parent for event " << ievent->name;
270 continue;
271 }
266272
267 if(ievent->len > 0 && ievent->mask & IN_MODIFY)273 if(ievent->len > 0 && ievent->mask & IN_MODIFY)
268 {274 {

Subscribers

People subscribed via source and target branches