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

Unified Diff: chrome/browser/extensions/menu_manager.cc

Issue 2740143002: Change base::Value::ListStorage to std::vector<base::Value> (Closed)
Patch Set: Comment Updates Created 3 years, 9 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
Index: chrome/browser/extensions/menu_manager.cc
diff --git a/chrome/browser/extensions/menu_manager.cc b/chrome/browser/extensions/menu_manager.cc
index 11acf54ca5d1458c8ee8c4ea7ee8248ce2157998..798fe5e3a75bd92845f201cc35e63c01f87023d8 100644
--- a/chrome/browser/extensions/menu_manager.cc
+++ b/chrome/browser/extensions/menu_manager.cc
@@ -665,8 +665,12 @@ void MenuManager::ExecuteCommand(content::BrowserContext* context,
webview_guest->view_instance_id());
}
- base::DictionaryValue* raw_properties = properties.get();
+ size_t properties_idx = args->GetSize();
args->Append(std::move(properties));
+ // |properties| is invalidated at this time, which is why |args| needs to be
+ // queried for the pointer.
+ base::DictionaryValue* raw_properties;
Devlin 2017/03/15 15:25:04 nit: initialize to nullptr
jdoerrie 2017/03/23 18:11:17 Done.
+ args->GetDictionary(properties_idx, &raw_properties);
// Add the tab info to the argument list.
// No tab info in a platform app.
@@ -683,6 +687,10 @@ void MenuManager::ExecuteCommand(content::BrowserContext* context,
}
}
+ // |args->Append| might have invalidated pointers, which is why |args| needs
Devlin 2017/03/15 15:25:03 Oof, that's subtle. Do we have any way of checkin
brettw 2017/03/15 22:14:14 Yes, there should be no pointers in the API when w
jdoerrie 2017/03/23 18:11:17 To answer your first question, yes, we can determi
+ // to be queried again for the pointer.
+ args->GetDictionary(properties_idx, &raw_properties);
+
if (item->type() == MenuItem::CHECKBOX ||
item->type() == MenuItem::RADIO) {
bool was_checked = item->checked();

Powered by Google App Engine
This is Rietveld 408576698