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

Unified Diff: chrome/browser/sync/glue/sync_backend_host.cc

Issue 10830100: Fix SyncManager initialization failure crash. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add virtual destructor Created 8 years, 5 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
« no previous file with comments | « no previous file | chrome/browser/sync/profile_sync_service_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/glue/sync_backend_host.cc
diff --git a/chrome/browser/sync/glue/sync_backend_host.cc b/chrome/browser/sync/glue/sync_backend_host.cc
index 295bb8c5f7ea6b4d89007e75e9ce6f0fe54bda97..31951e15220580b8d59aa1cf914e1047bf1c047b 100644
--- a/chrome/browser/sync/glue/sync_backend_host.cc
+++ b/chrome/browser/sync/glue/sync_backend_host.cc
@@ -846,6 +846,13 @@ void SyncBackendHost::Core::OnInitializationComplete(
bool success,
const syncer::ModelTypeSet restored_types) {
DCHECK_EQ(MessageLoop::current(), sync_loop_);
+
+ if (!success) {
+ sync_manager_->RemoveObserver(this);
+ sync_manager_->ShutdownOnSyncThread();
+ sync_manager_.reset();
+ }
+
host_.Call(
FROM_HERE,
&SyncBackendHost::HandleSyncManagerInitializationOnFrontendLoop,
@@ -1051,19 +1058,22 @@ void SyncBackendHost::Core::DoRefreshNigori(
void SyncBackendHost::Core::DoStopSyncManagerForShutdown(
const base::Closure& closure) {
- DCHECK(sync_manager_.get());
- sync_manager_->StopSyncingForShutdown(closure);
+ if (sync_manager_.get()) {
+ sync_manager_->StopSyncingForShutdown(closure);
+ } else {
+ sync_loop_->PostTask(FROM_HERE, closure);
+ }
}
void SyncBackendHost::Core::DoShutdown(bool sync_disabled) {
DCHECK_EQ(MessageLoop::current(), sync_loop_);
- if (!sync_manager_.get())
- return;
+ if (sync_manager_.get()) {
+ save_changes_timer_.reset();
+ sync_manager_->ShutdownOnSyncThread();
+ sync_manager_->RemoveObserver(this);
+ sync_manager_.reset();
+ }
- save_changes_timer_.reset();
- sync_manager_->ShutdownOnSyncThread();
- sync_manager_->RemoveObserver(this);
- sync_manager_.reset();
chrome_sync_notification_bridge_ = NULL;
registrar_ = NULL;
« no previous file with comments | « no previous file | chrome/browser/sync/profile_sync_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698