diff options
author | altimofeev@chromium.org <altimofeev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-30 16:12:55 +0000 |
---|---|---|
committer | altimofeev@chromium.org <altimofeev@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-03-30 16:12:55 +0000 |
commit | 24e159b04c6078a6c395cd2170e7ebef627727d3 (patch) | |
tree | a0a816de36721bd65df906a8da241248ad68de94 | |
parent | 4db2dd8dbe0ada3bfee486e507096723f15b7d82 (diff) | |
download | chromium_src-24e159b04c6078a6c395cd2170e7ebef627727d3.zip chromium_src-24e159b04c6078a6c395cd2170e7ebef627727d3.tar.gz chromium_src-24e159b04c6078a6c395cd2170e7ebef627727d3.tar.bz2 |
Fixes possible NULL pointer crash.
BUG=none
TEST=Run out of the box in the debug mode, no DCHECKs should fail.
Review URL: http://codereview.chromium.org/6675041
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@79837 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/chromeos/login/base_login_display_host.cc | 2 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/existing_user_controller.cc | 8 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/wizard_controller.cc | 13 |
3 files changed, 18 insertions, 5 deletions
diff --git a/chrome/browser/chromeos/login/base_login_display_host.cc b/chrome/browser/chromeos/login/base_login_display_host.cc index 13ac0e5..935a4c5 100644 --- a/chrome/browser/chromeos/login/base_login_display_host.cc +++ b/chrome/browser/chromeos/login/base_login_display_host.cc @@ -104,6 +104,7 @@ void BaseLoginDisplayHost::StartWizard( const GURL& start_url) { DVLOG(1) << "Starting wizard, first_screen_name: " << first_screen_name; // Create and show the wizard. + wizard_controller_.reset(); // Only one controller in a time. wizard_controller_.reset(new WizardController(this, background_bounds_)); wizard_controller_->SetCustomization(manifest); wizard_controller_->set_start_url(start_url); @@ -127,6 +128,7 @@ void BaseLoginDisplayHost::StartSignInScreen() { WizardController::MarkDeviceRegistered(); } + sign_in_controller_.reset(); // Only one controller in a time. sign_in_controller_.reset(new chromeos::ExistingUserController(this)); ShowBackground(); SetShutdownButtonEnabled(true); diff --git a/chrome/browser/chromeos/login/existing_user_controller.cc b/chrome/browser/chromeos/login/existing_user_controller.cc index 20b0518..4aa8bfa 100644 --- a/chrome/browser/chromeos/login/existing_user_controller.cc +++ b/chrome/browser/chromeos/login/existing_user_controller.cc @@ -66,6 +66,7 @@ ExistingUserController::ExistingUserController(LoginDisplayHost* host) num_login_attempts_(0), user_settings_(new UserCrosSettingsProvider), method_factory_(this) { + DCHECK(current_controller_ == NULL); current_controller_ = this; login_display_.reset(host_->CreateLoginDisplay(this)); @@ -138,8 +139,11 @@ void ExistingUserController::Observe(NotificationType type, // ExistingUserController, private: ExistingUserController::~ExistingUserController() { - DCHECK(current_controller_ != NULL); - current_controller_ = NULL; + if (current_controller_ == this) { + current_controller_ = NULL; + } else { + NOTREACHED() << "More than one controller are alive."; + } } //////////////////////////////////////////////////////////////////////////////// diff --git a/chrome/browser/chromeos/login/wizard_controller.cc b/chrome/browser/chromeos/login/wizard_controller.cc index 0bde193..7480735 100644 --- a/chrome/browser/chromeos/login/wizard_controller.cc +++ b/chrome/browser/chromeos/login/wizard_controller.cc @@ -245,7 +245,12 @@ WizardController::~WizardController() { widget_ = NULL; } - default_controller_ = NULL; + if (default_controller_ == this) { + default_controller_ = NULL; + } else { + NOTREACHED() << "More than one controller are alive."; + } + chromeos::WizardAccessibilityHelper::GetInstance()-> UnregisterNotifications(); } @@ -353,8 +358,10 @@ void WizardController::ShowLoginScreen() { host_->SetOobeProgress(chromeos::BackgroundView::SIGNIN); host_->StartSignInScreen(); smooth_show_timer_.Stop(); - widget_->Close(); - widget_ = NULL; + if (widget_) { + widget_->Close(); + widget_ = NULL; + } is_active_ = false; } |