| Index: src/device.cc
|
| diff --git a/src/device.cc b/src/device.cc
|
| index abcc781d984dbaf83a741a52a3c5eef24ef6269c..b5ac6f5103d8a1c05e82b0f6633d7bd6b965b6a0 100644
|
| --- a/src/device.cc
|
| +++ b/src/device.cc
|
| @@ -47,6 +47,7 @@ Device::Device(Service * const parent, DBus::Connection& connection, // NOLINT
|
| if (get_properties_source_id_ == 0) {
|
| LOG(ERROR) << path_ << ": ctor: g_idle_add failed";
|
| }
|
| + property_changed_handler_.delegate(this);
|
| }
|
|
|
| Device::~Device() {
|
| @@ -78,6 +79,21 @@ const std::string& Device::GetInterface() const {
|
| void Device::PropertyChanged(const std::string& property_name,
|
| const DBus::Variant& new_value) {
|
| DLOG(INFO) << path_ << ": PropertyChanged: property_name = " << property_name;
|
| + // Queue a tuple representing this signal for later processing from the glib
|
| + // main loop. We do this to avoid libdbus-c++ deadlocks that can occur when
|
| + // sending a dbus message from within a dbus callback like this one.
|
| + PropertyChangedSignal signal(property_name, new_value);
|
| + property_changed_handler_.EnqueueSignal(signal);
|
| +}
|
| +
|
| +// PropertyChangedDelegate methods
|
| +
|
| +void Device::OnPropertyChanged(const PropertyChangedHandler *handler,
|
| + const std::string& property_name,
|
| + const DBus::Variant& new_value) {
|
| + DCHECK(handler == &property_changed_handler_);
|
| + DLOG(INFO) << path_ << ": OnPropertyChanged: property_name = "
|
| + << property_name;
|
| if (property_name == kFlimflamDeviceCarrierProperty) {
|
| OnCarrierUpdate(new_value.reader().get_string());
|
| } else if (property_name == kFlimflamDeviceInterfaceProperty) {
|
|
|