diff options
Diffstat (limited to 'win8/test')
-rw-r--r-- | win8/test/ui_automation_client.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/win8/test/ui_automation_client.cc b/win8/test/ui_automation_client.cc index ef742f2..8c866308 100644 --- a/win8/test/ui_automation_client.cc +++ b/win8/test/ui_automation_client.cc @@ -158,7 +158,11 @@ HRESULT UIAutomationClient::Context::EventHandler::HandleAutomationEvent( base::WeakPtr<UIAutomationClient::Context> UIAutomationClient::Context::Create() { Context* context = new Context(); - return context->weak_ptr_factory_.GetWeakPtr(); + base::WeakPtr<Context> context_ptr(context->weak_ptr_factory_.GetWeakPtr()); + // Unbind from this thread so that the instance will bind to the automation + // thread when Initialize is called. + context->weak_ptr_factory_.DetachFromThread(); + return context_ptr; } void UIAutomationClient::Context::DeleteOnAutomationThread() { |