summaryrefslogtreecommitdiffstats
path: root/chromeos/audio
diff options
context:
space:
mode:
authormohan.reddy <mohan.reddy@samsung.com>2014-09-10 20:53:52 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-11 03:59:03 +0000
commit945f5aa3a9b0f3c4e43329d1ada1fb8b64b76d73 (patch)
tree592d2cb399f0c0c1dddaf2b752fecbcbb4091ca9 /chromeos/audio
parenta4eb244baaac411fe27fb2282e62a80ee20fe1ff (diff)
downloadchromium_src-945f5aa3a9b0f3c4e43329d1ada1fb8b64b76d73.zip
chromium_src-945f5aa3a9b0f3c4e43329d1ada1fb8b64b76d73.tar.gz
chromium_src-945f5aa3a9b0f3c4e43329d1ada1fb8b64b76d73.tar.bz2
Changing the order of initialization WeakPtrFactory
Changing in the intialization order of WeakPtrFactory 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/552323003 Cr-Commit-Position: refs/heads/master@{#294319}
Diffstat (limited to 'chromeos/audio')
-rw-r--r--chromeos/audio/cras_audio_handler.cc4
-rw-r--r--chromeos/audio/cras_audio_handler.h3
2 files changed, 4 insertions, 3 deletions
diff --git a/chromeos/audio/cras_audio_handler.cc b/chromeos/audio/cras_audio_handler.cc
index 295f280..1907190 100644
--- a/chromeos/audio/cras_audio_handler.cc
+++ b/chromeos/audio/cras_audio_handler.cc
@@ -327,7 +327,6 @@ void CrasAudioHandler::LogErrors() {
CrasAudioHandler::CrasAudioHandler(
scoped_refptr<AudioDevicesPrefHandler> audio_pref_handler)
: audio_pref_handler_(audio_pref_handler),
- weak_ptr_factory_(this),
output_mute_on_(false),
input_mute_on_(false),
output_volume_(0),
@@ -338,7 +337,8 @@ CrasAudioHandler::CrasAudioHandler(
has_alternative_output_(false),
output_mute_locked_(false),
input_mute_locked_(false),
- log_errors_(false) {
+ log_errors_(false),
+ weak_ptr_factory_(this) {
if (!audio_pref_handler.get())
return;
// If the DBusThreadManager or the CrasAudioClient aren't available, there
diff --git a/chromeos/audio/cras_audio_handler.h b/chromeos/audio/cras_audio_handler.h
index 9935963..92850b1 100644
--- a/chromeos/audio/cras_audio_handler.h
+++ b/chromeos/audio/cras_audio_handler.h
@@ -255,7 +255,6 @@ class CHROMEOS_EXPORT CrasAudioHandler : public CrasAudioClient::Observer,
AudioDevice GetSanitizedAudioDevice(const AudioNode& node);
scoped_refptr<AudioDevicesPrefHandler> audio_pref_handler_;
- base::WeakPtrFactory<CrasAudioHandler> weak_ptr_factory_;
ObserverList<AudioObserver> observers_;
// Audio data and state.
@@ -279,6 +278,8 @@ class CHROMEOS_EXPORT CrasAudioHandler : public CrasAudioClient::Observer,
// Failures are not logged at startup, since CRAS may not be running yet.
bool log_errors_;
+ base::WeakPtrFactory<CrasAudioHandler> weak_ptr_factory_;
+
DISALLOW_COPY_AND_ASSIGN(CrasAudioHandler);
};