chromiumembedded / cef

Chromium Embedded Framework (CEF). A simple framework for embedding Chromium-based browsers in other applications.
https://bitbucket.org/chromiumembedded/cef/
Other
3.31k stars 463 forks source link

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

Closed magreenblatt closed 13 years ago

magreenblatt commented 13 years ago

Original report by Anonymous.


Original issue 320 created by ckchien on 2011-08-31T11:33:45.000Z:

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.

magreenblatt commented 13 years ago

Original comment by Dmitry Azaraev (Bitbucket: Mystic Artifact).


Comment 1. originally posted by fddima on 2011-09-15T20:34:34.000Z:

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

magreenblatt commented 13 years ago

Comment 2. originally posted by magreenblatt on 2011-10-21T20:50:20.000Z:

Thanks, fixed in revision 335.

magreenblatt commented 13 years ago