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

Unified Diff: components/autofill/content/renderer/autofill_agent.cc

Issue 1943873002: Postpone deletion of (Password)AutofillAgent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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: components/autofill/content/renderer/autofill_agent.cc
diff --git a/components/autofill/content/renderer/autofill_agent.cc b/components/autofill/content/renderer/autofill_agent.cc
index e233d106484d074fd3e691c6aa492bbbd637b3ca..788e01b767f5e90a137f7a131b8ac468beeb5011 100644
--- a/components/autofill/content/renderer/autofill_agent.cc
+++ b/components/autofill/content/renderer/autofill_agent.cc
@@ -312,6 +312,14 @@ void AutofillAgent::FocusedNodeChanged(const WebNode& node) {
element_ = *element;
}
+void AutofillAgent::OnDestruct() {
+ // As described in http://crbug.com/608100, there might be an AutofillAgent
+ // method in-progress lower on the stack. Destroying |this| would cause
+ // use-after-free once the lower stack frame becomes active. Instead, a task
+ // needs to be posted to delete this.
+ base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, this);
+}
+
void AutofillAgent::FocusChangeComplete() {
WebDocument doc = render_frame()->GetWebFrame()->document();
WebElement focused_element;
« no previous file with comments | « components/autofill/content/renderer/autofill_agent.h ('k') | components/autofill/content/renderer/password_autofill_agent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698