sapioit / chromiumembedded

Automatically exported from code.google.com/p/chromiumembedded
0 stars 0 forks source link

Is SetFocus() supported in non UI thread? #320

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Use libcef debug build.
2. Call CefBrowser::SetFocus() from non UI thread.
3. Will get exception in debugger.

What is the expected output? What do you see instead?
Should not get exception in SetFocus().

What version of the product are you using? On what operating system?
Windows 7

Please provide any additional information below.

Trace to browser_impl.cc:
void CefBrowserImpl::SetFocus(bool enable)
{
  if (CefThread::CurrentlyOn(CefThread::UI)) {
    UIT_SetFocus(UIT_GetWebViewHost(), enable);
  } else {
    CefThread::PostTask(CefThread::UI, FROM_HERE, NewRunnableMethod(this,
        &CefBrowserImpl::UIT_SetFocus, UIT_GetWebViewHost(), enable));
  }
}

Original SetFocus() seems to support called from non UI thread.
But it calls UIT_GetWebViewHost().
In UIT_GetWebViewHost(), there is a REQUIRE_UIT() assertion and lead to 
exception.

Could you please check if my understanding is right?
Thanks in advanced.

Original issue reported on code.google.com by ckch...@gmail.com on 31 Aug 2011 at 11:33

GoogleCodeExporter commented 9 years ago
I confirm this issue.
In CefGlue i'm use workaround for this - i'm post task to UI thread to execute 
SetFocus.

Original comment by fdd...@gmail.com on 15 Sep 2011 at 8:34

GoogleCodeExporter commented 9 years ago
Thanks, fixed in revision 335.

Original comment by magreenb...@gmail.com on 21 Oct 2011 at 8:50