Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(8426)

Unified Diff: dbus/object_proxy.cc

Issue 8161005: Fix a bug in dbus::Bus::AddFilterFunction(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« dbus/bus.cc ('K') | « dbus/bus_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dbus/object_proxy.cc
diff --git a/dbus/object_proxy.cc b/dbus/object_proxy.cc
index 7d24c7e5af51cc7394afafba9c6bece668fe84cd..f4e4ac09952f560392c38d7656b963b2719dd080 100644
--- a/dbus/object_proxy.cc
+++ b/dbus/object_proxy.cc
@@ -124,8 +124,11 @@ void ObjectProxy::ConnectToSignal(const std::string& interface_name,
void ObjectProxy::Detach() {
bus_->AssertOnDBusThread();
- if (filter_added_)
- bus_->RemoveFilterFunction(&ObjectProxy::HandleMessageThunk, this);
+ if (filter_added_) {
+ if (!bus_->RemoveFilterFunction(&ObjectProxy::HandleMessageThunk, this)) {
+ LOG(ERROR) << "Failed to remove filter function";
+ }
+ }
for (size_t i = 0; i < match_rules_.size(); ++i) {
ScopedDBusError error;
@@ -277,8 +280,11 @@ void ObjectProxy::ConnectToSignalInternal(
// We should add the filter only once. Otherwise, HandleMessage() will
// be called more than once.
if (!filter_added_) {
- bus_->AddFilterFunction(&ObjectProxy::HandleMessageThunk, this);
- filter_added_ = true;
+ if (bus_->AddFilterFunction(&ObjectProxy::HandleMessageThunk, this)) {
+ filter_added_ = true;
+ } else {
+ LOG(ERROR) << "Failed to add filter function";
+ }
}
// Add a match rule so the signal goes through HandleMessage().
//
« dbus/bus.cc ('K') | « dbus/bus_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698