diff options
author | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-06 00:20:53 +0000 |
---|---|---|
committer | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-06 00:20:53 +0000 |
commit | 12e2599805235b139796ffee9598e8c95768b21a (patch) | |
tree | ac743b9e174698ebdeb96f8ffaba3e356db71cc3 /dbus/object_proxy.cc | |
parent | b1e2d361992fb4dfed9422df35f161442850909a (diff) | |
download | chromium_src-12e2599805235b139796ffee9598e8c95768b21a.zip chromium_src-12e2599805235b139796ffee9598e8c95768b21a.tar.gz chromium_src-12e2599805235b139796ffee9598e8c95768b21a.tar.bz2 |
Fix a bug in dbus::Bus::AddFilterFunction().
We should not reject the same function if it's associated with different data.
BUG=99258
TEST=adde a unit test and confirmed it passed.
Review URL: http://codereview.chromium.org/8161005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104208 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'dbus/object_proxy.cc')
-rw-r--r-- | dbus/object_proxy.cc | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/dbus/object_proxy.cc b/dbus/object_proxy.cc index 7d24c7e..f4e4ac0 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(). // |