diff options
author | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-13 00:45:26 +0000 |
---|---|---|
committer | satorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-13 00:45:26 +0000 |
commit | 6477a41b085ee5e470a0862848281f5009e5cb9f (patch) | |
tree | 5ece0468bd892176667d30833a2503e449517f98 /dbus/bus.cc | |
parent | 66212d0735400e240ac4fc371b57637138754944 (diff) | |
download | chromium_src-6477a41b085ee5e470a0862848281f5009e5cb9f.zip chromium_src-6477a41b085ee5e470a0862848281f5009e5cb9f.tar.gz chromium_src-6477a41b085ee5e470a0862848281f5009e5cb9f.tar.bz2 |
Make ExportedObject and ObjectProxy own Bus as scoped_refptr.
They should own Bus as scoped_refptr, rather than raw pointer.
Otherwise, they may reference |bus_| after Bus is deleted.
I know this is convoluted. I'm planning to minimize use of
scoped_refptr from dbus/* but this change is necessary until then.
TEST=run dbus_unittest under valgrind and confirm no memory leaks
BUG=chromium-os:21379
Review URL: http://codereview.chromium.org/8201023
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@105222 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'dbus/bus.cc')
-rw-r--r-- | dbus/bus.cc | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/dbus/bus.cc b/dbus/bus.cc index 858f686..e0ef031 100644 --- a/dbus/bus.cc +++ b/dbus/bus.cc @@ -293,6 +293,12 @@ void Bus::ShutdownAndBlock() { iter->second->Detach(); } + // Release object proxies and exported objects here. We should do this + // here rather than in the destructor to avoid memory leaks due to + // cyclic references. + object_proxy_table_.clear(); + exported_object_table_.clear(); + // Private connection should be closed. if (connection_) { if (connection_type_ == PRIVATE) |