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

Unified Diff: media/audio/alsa/alsa_input.h

Issue 193303002: WeakPtr destruction order cleanup: media edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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
Index: media/audio/alsa/alsa_input.h
diff --git a/media/audio/alsa/alsa_input.h b/media/audio/alsa/alsa_input.h
index 6e9aad9056ebf643d5f2b3c1b2ab6c51f3417d33..d0fc02ab0070da00fbce51b1d6d4b23a84012dea 100644
--- a/media/audio/alsa/alsa_input.h
+++ b/media/audio/alsa/alsa_input.h
@@ -80,10 +80,13 @@ class AlsaPcmInputStream : public AgcAudioStream<AudioInputStream> {
snd_pcm_t* device_handle_; // Handle to the ALSA PCM recording device.
snd_mixer_t* mixer_handle_; // Handle to the ALSA microphone mixer.
snd_mixer_elem_t* mixer_element_handle_; // Handle to the capture element.
- base::WeakPtrFactory<AlsaPcmInputStream> weak_factory_;
scoped_ptr<uint8[]> audio_buffer_; // Buffer used for reading audio data.
bool read_callback_behind_schedule_;
+ // NOTE: This must always be last so it's invalidated before other member
+ // variables might be accessed.
+ base::WeakPtrFactory<AlsaPcmInputStream> weak_factory_;
+
DISALLOW_COPY_AND_ASSIGN(AlsaPcmInputStream);
};

Powered by Google App Engine
This is Rietveld 408576698