diff options
author | johnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-09 17:20:53 +0000 |
---|---|---|
committer | johnnyg@chromium.org <johnnyg@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-07-09 17:20:53 +0000 |
commit | 8b46a3f8b8d138b391ebe93c1b8e43bb2fc18e97 (patch) | |
tree | 86fb076d2b0b36eaa99b23bb90d81c3d8572068f /chrome | |
parent | 91059f84958779af809d61e4b9bd9301202cf215 (diff) | |
download | chromium_src-8b46a3f8b8d138b391ebe93c1b8e43bb2fc18e97.zip chromium_src-8b46a3f8b8d138b391ebe93c1b8e43bb2fc18e97.tar.gz chromium_src-8b46a3f8b8d138b391ebe93c1b8e43bb2fc18e97.tar.bz2 |
Current code will definitely crash if ACTION_DELETE is passed to ThemeChangeProcessor, since the error will clear the profile_ without returning, and the profile is accessed later. Since the code discusses how to process deletes, I think this is the correct fix.
BUG=none
TEST=sync themes and then delete it
Review URL: http://codereview.chromium.org/2913006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@51976 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/sync/glue/theme_change_processor.cc | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/chrome/browser/sync/glue/theme_change_processor.cc b/chrome/browser/sync/glue/theme_change_processor.cc index c4e4f68..58c3df3 100644 --- a/chrome/browser/sync/glue/theme_change_processor.cc +++ b/chrome/browser/sync/glue/theme_change_processor.cc @@ -155,9 +155,11 @@ void ThemeChangeProcessor::ApplyChangesFromSyncModel( } const sync_api::SyncManager::ChangeRecord& change = changes[change_count - 1]; - if (change.action != sync_api::SyncManager::ChangeRecord::ACTION_UPDATE) { + if (change.action != sync_api::SyncManager::ChangeRecord::ACTION_UPDATE && + change.action != sync_api::SyncManager::ChangeRecord::ACTION_DELETE) { std::string err = "strange theme change.action " + change.action; error_handler()->OnUnrecoverableError(FROM_HERE, err); + return; } sync_pb::ThemeSpecifics theme_specifics; // If the action is a delete, simply use the default values for @@ -165,8 +167,8 @@ void ThemeChangeProcessor::ApplyChangesFromSyncModel( if (change.action != sync_api::SyncManager::ChangeRecord::ACTION_DELETE) { sync_api::ReadNode node(trans); if (!node.InitByIdLookup(change.id)) { - error_handler()->OnUnrecoverableError(FROM_HERE, - "Theme node lookup failed."); + error_handler()->OnUnrecoverableError(FROM_HERE, + "Theme node lookup failed."); return; } DCHECK_EQ(node.GetModelType(), syncable::THEMES); |