diff options
author | anujk.sharma <anujk.sharma@samsung.com> | 2014-10-15 00:20:06 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-15 07:20:25 +0000 |
commit | 755aaca0859cf9db13fb17d99e987ade0553af6a (patch) | |
tree | 0d7e7073f097ff8fa50b9509c5a57d7317afe74e | |
parent | 6ceadcff9f15e7955b7e47833f053c2e579aa075 (diff) | |
download | chromium_src-755aaca0859cf9db13fb17d99e987ade0553af6a.zip chromium_src-755aaca0859cf9db13fb17d99e987ade0553af6a.tar.gz chromium_src-755aaca0859cf9db13fb17d99e987ade0553af6a.tar.bz2 |
Fix WeakPtrFactory member placement
Changing in the intialization order of WeakPtrFactory in src/ipc module
such that all member variables should appear before the WeakPtrFactory
to ensure that any WeakPtrs to Controller are invalidated before its members
variable's destructors are executed, rendering them invalid.
BUG=303818
Review URL: https://codereview.chromium.org/645123004
Cr-Commit-Position: refs/heads/master@{#299660}
-rw-r--r-- | ipc/mojo/ipc_channel_mojo_host.cc | 8 | ||||
-rw-r--r-- | ipc/mojo/ipc_channel_mojo_host.h | 2 |
2 files changed, 5 insertions, 5 deletions
diff --git a/ipc/mojo/ipc_channel_mojo_host.cc b/ipc/mojo/ipc_channel_mojo_host.cc index efe2a2c..6f9075a 100644 --- a/ipc/mojo/ipc_channel_mojo_host.cc +++ b/ipc/mojo/ipc_channel_mojo_host.cc @@ -31,8 +31,8 @@ class ChannelMojoHost::ChannelDelegate : public ChannelMojo::Delegate { private: scoped_refptr<base::TaskRunner> io_task_runner_; - base::WeakPtrFactory<ChannelDelegate> weak_factory_; base::WeakPtr<ChannelMojo> channel_; + base::WeakPtrFactory<ChannelDelegate> weak_factory_; DISALLOW_COPY_AND_ASSIGN(ChannelDelegate); }; @@ -84,9 +84,9 @@ void ChannelMojoHost::ChannelDelegate::DeleteThisSoon() { // ChannelMojoHost::ChannelMojoHost(scoped_refptr<base::TaskRunner> io_task_runner) - : weak_factory_(this), - io_task_runner_(io_task_runner), - channel_delegate_(new ChannelDelegate(io_task_runner)) { + : io_task_runner_(io_task_runner), + channel_delegate_(new ChannelDelegate(io_task_runner)), + weak_factory_(this) { } ChannelMojoHost::~ChannelMojoHost() { diff --git a/ipc/mojo/ipc_channel_mojo_host.h b/ipc/mojo/ipc_channel_mojo_host.h index dd67897e..8289515 100644 --- a/ipc/mojo/ipc_channel_mojo_host.h +++ b/ipc/mojo/ipc_channel_mojo_host.h @@ -39,9 +39,9 @@ class IPC_MOJO_EXPORT ChannelMojoHost { void operator()(ChannelDelegate* ptr) const; }; - base::WeakPtrFactory<ChannelMojoHost> weak_factory_; const scoped_refptr<base::TaskRunner> io_task_runner_; scoped_ptr<ChannelDelegate, DelegateDeleter> channel_delegate_; + base::WeakPtrFactory<ChannelMojoHost> weak_factory_; DISALLOW_COPY_AND_ASSIGN(ChannelMojoHost); }; |