cashew: do not delete DBus::ObjectProxy objects from D-Bus callbacks
This CL resolves a deadlock that causes cashew to hang indefinitely.
Deleting a subclass of DBus::ObjectProxy such as Service or Device
causes an unregister message to be sent to the bus daemon, and is
effectively the same as explicitly sending a D-Bus message from within a
D-Bus callback. As such, it can trigger the same libdbus-c++ deadlock
that caused issues 8516 and 8486.
We avoid this by scheduling deferred deletion of these objects from the
main loop.
BUG=chromium-os:8892
TEST=manual testing on device (suspend/resume while connected to 3G)
Change-Id: I5882bb581a2b3edb440954d1c32a41fef48ac48d
Review URL: http://codereview.chromium.org/5333003
7 files changed