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(); |