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

Side by Side Diff: media/audio/audio_manager.cc

Issue 6878081: Blind fix for a Linux only crash in AudioManager::Destroy (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 9 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/audio/audio_manager.h" 5 #include "media/audio/audio_manager.h"
6 6
7 #include "base/at_exit.h" 7 #include "base/at_exit.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 9
10 static bool g_destroy_called = false; 10 static bool g_destroy_called = false;
11 static AudioManager* g_audio_manager = NULL; 11 static AudioManager* g_audio_manager = NULL;
12 12
13 // static 13 // static
14 void AudioManager::Destroy(void* not_used) { 14 void AudioManager::Destroy(void* not_used) {
15 g_destroy_called = true; 15 g_destroy_called = true;
16 16
17 g_audio_manager->Cleanup(); 17 if (g_audio_manager) {
18 g_audio_manager->Cleanup();
18 19
19 AudioManager* audio_manager = g_audio_manager; 20 AudioManager* audio_manager = g_audio_manager;
20 g_audio_manager = NULL; 21 g_audio_manager = NULL;
21 delete audio_manager; 22 delete audio_manager;
23 }
22 } 24 }
23 25
24 // static 26 // static
25 AudioManager* AudioManager::GetAudioManager() { 27 AudioManager* AudioManager::GetAudioManager() {
26 if (!g_audio_manager && !g_destroy_called) { 28 if (!g_audio_manager && !g_destroy_called) {
27 g_audio_manager = CreateAudioManager(); 29 g_audio_manager = CreateAudioManager();
28 g_audio_manager->Init(); 30 g_audio_manager->Init();
29 base::AtExitManager::RegisterCallback(&AudioManager::Destroy, NULL); 31 base::AtExitManager::RegisterCallback(&AudioManager::Destroy, NULL);
30 } 32 }
31 return g_audio_manager; 33 return g_audio_manager;
32 } 34 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698