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

Unified Diff: chrome/browser/automation/automation_event_observers.cc

Issue 10386144: Fixed a possible memory leak and support null pointers in AutomationEventObservers' NotifyEvent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/automation/automation_event_observers_chromeos.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/automation/automation_event_observers.cc
diff --git a/chrome/browser/automation/automation_event_observers.cc b/chrome/browser/automation/automation_event_observers.cc
index a2e05d326f6bb19eba2c0bbc6ab3c3c6d5d14366..8f2f5acd6d5245aed075e2003d0f3668bc13a650 100644
--- a/chrome/browser/automation/automation_event_observers.cc
+++ b/chrome/browser/automation/automation_event_observers.cc
@@ -29,10 +29,15 @@ AutomationEventObserver::~AutomationEventObserver() {}
void AutomationEventObserver::NotifyEvent(DictionaryValue* value) {
if (event_queue_) {
dennis_jeffrey 2012/05/16 16:55:42 Will "value" get deleted on the "true" branch of t
craigdh 2012/05/16 17:00:55 Yes. On "true" the AutomationEventQueue takes owne
+ if (!value)
+ value = new DictionaryValue;
dennis_jeffrey 2012/05/16 16:55:42 Is this check needed? It looks like both callers
craigdh 2012/05/16 17:00:55 Right now NULL is not being passed, but is because
+ value->SetInteger("observer_id", GetId());
event_queue_->NotifyEvent(
new AutomationEventQueue::AutomationEvent(
GetId(), value));
event_count_++;
+ } else if (value) {
+ delete value;
}
}
@@ -92,7 +97,6 @@ void DomEventObserver::Observe(
DictionaryValue* dict = new DictionaryValue;
dict->SetString("type", "raised_event");
dict->SetString("name", dom_op_details->json);
- dict->SetInteger("observer_id", GetId());
NotifyEvent(dict);
}
}
« no previous file with comments | « no previous file | chrome/browser/automation/automation_event_observers_chromeos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698