diff options
author | tim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-15 23:09:25 +0000 |
---|---|---|
committer | tim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-06-15 23:09:25 +0000 |
commit | c774bfa1edf43f64b881f9e0061c6c179e0c5e63 (patch) | |
tree | d9e62dd3f6f14b70b0722eedc56d2a3e970e4c19 /chrome | |
parent | bbf4400222e3b4eec801780aefe025d74aa9a339 (diff) | |
download | chromium_src-c774bfa1edf43f64b881f9e0061c6c179e0c5e63.zip chromium_src-c774bfa1edf43f64b881f9e0061c6c179e0c5e63.tar.gz chromium_src-c774bfa1edf43f64b881f9e0061c6c179e0c5e63.tar.bz2 |
sync: null-check the Directory ChannelHookup before adding a new observer so we don't add observers twice.
BUG=46596
TEST=on a debug / unofficial build, re-login to sync (e.g. using --invalidate-sync-login). browser shouldn't crash.
Review URL: http://codereview.chromium.org/2799007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49855 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/sync/engine/syncapi.cc | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/chrome/browser/sync/engine/syncapi.cc b/chrome/browser/sync/engine/syncapi.cc index 1a2da8b..754ddae 100644 --- a/chrome/browser/sync/engine/syncapi.cc +++ b/chrome/browser/sync/engine/syncapi.cc @@ -1798,7 +1798,12 @@ void SyncManager::SyncInternal::HandleAuthWatcherEvent( << "up directory change event listener!"; return; } - dir_change_hookup_.reset(lookup->AddChangeObserver(this)); + + // Note that we can end up here multiple times, for example if the + // user had to re-login and we got a second AUTH_SUCCEEDED event. Take + // care not to add ourselves as an observer a second time. + if (!dir_change_hookup_.get()) + dir_change_hookup_.reset(lookup->AddChangeObserver(this)); } if (InitialSyncEndedForAllEnabledTypes()) MarkAndNotifyInitializationComplete(); |