summaryrefslogtreecommitdiffstats
path: root/chrome/test/automation
diff options
context:
space:
mode:
authorstoyan@chromium.org <stoyan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-29 16:44:10 +0000
committerstoyan@chromium.org <stoyan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-01-29 16:44:10 +0000
commit14fe07ae4bd0e487794ef4176dced613ff3971c9 (patch)
treeef54e591d71dbd52fabf8d517af3d8bc1daab518 /chrome/test/automation
parentda5dcd1736d1c984fc5ce6a04e5b8844396edd8e (diff)
downloadchromium_src-14fe07ae4bd0e487794ef4176dced613ff3971c9.zip
chromium_src-14fe07ae4bd0e487794ef4176dced613ff3971c9.tar.gz
chromium_src-14fe07ae4bd0e487794ef4176dced613ff3971c9.tar.bz2
Create and destroy members of the AutomationProxy in the correct order to avoid possible crash.
Review URL: http://codereview.chromium.org/19451 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@8882 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/automation')
-rw-r--r--chrome/test/automation/automation_proxy.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/chrome/test/automation/automation_proxy.cc b/chrome/test/automation/automation_proxy.cc
index 73ae223..f8d4b93 100644
--- a/chrome/test/automation/automation_proxy.cc
+++ b/chrome/test/automation/automation_proxy.cc
@@ -145,12 +145,22 @@ AutomationProxy::AutomationProxy(int command_execution_timeout_ms)
command_execution_timeout_ms_(command_execution_timeout_ms) {
InitializeEvents();
InitializeChannelID();
+ InitializeHandleTracker();
InitializeThread();
InitializeChannel();
- InitializeHandleTracker();
}
AutomationProxy::~AutomationProxy() {
+ // Destruction order is important. Thread has to outlive the channel and
+ // tracker has to outlive the thread since we access the tracker inside
+ // AutomationMessageFilter::OnMessageReceived.
+ channel_.reset();
+ thread_.reset();
+ DCHECK(NULL == current_request_);
+ tracker_.reset();
+ ::CloseHandle(app_launched_);
+ ::CloseHandle(initial_loads_complete_);
+ ::CloseHandle(new_tab_ui_load_complete_);
}
void AutomationProxy::InitializeEvents() {