CEF v: cef_binary_3.2704.1410.g80c7c1b_linux64
I decide to integrate wxwidgets and CEF.
CefDoMessageLoop is runnig from wxTimer on constant intervals.
I noticed that crash occurs only when CefDoMessageLoopWork() and CefBrowserHost::CreateBrowser() are both called.
If I don't call CefDoMessageLoopWork, CefBrowserHost::CreateBrowser() doesn't crash.
The program 'CEF_wxw' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadMatch (invalid parameter attributes)'.
(Details: serial 304 error_code 8 request_code 42 minor_code 0)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the --sync command line
option to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)
Main function:
- Code: Select all
CefMainArgs args(argc,argv);
CefRefPtr<AppHandler> app = new AppHandler; //CefApp implementation
int ret = CefExecuteProcess(args, app, NULL );
if(ret>=0)
{
return ret;
}
//wxw
MyApp *myapp = new MyApp;
wxAppConsole::SetInstance(myapp);
myapp->m_cefapp = app; // It will be passed to CefInitialize later
myapp->m_cefargs = args;
wxEntry(argc, argv);
Here is callback for initialization of wxWidgets:
- Code: Select all
bool MyApp::OnInit()
{
CefSettings sett;
sett.multi_threaded_message_loop = false;
sett.external_message_pump = true;
CefInitialize(m_cefargs, sett, m_cefapp, NULL);
MyFrame *myframe = new MyFrame("CEF + wxw", wxPoint(150,200), wxSize(400,200));
myframe->Show(true);
timer = new MyTimer;
timer->Start(20); // On 20ms intervals CefDoMessageLoop is calling
return true;
}
CefBrowserHost::CreateBrowser is called in response to button click. Here is callback:
- Code: Select all
CefWindowInfo wnd_info;
// CefWindowHandle x_handle = gdk_x11_drawable_get_xid(gtk_widget_get_window(GetHandle())); For test I comment it
// wnd_info.SetAsChild( x_handle, CefRect(0,0,100,100) );
CefBrowserSettings sett;
// CefRefPtr<ClientHandler> client = new ClientHandler(); // It no matter if I pass CefClient object or not
CefBrowserHost::CreateBrowser(wnd_info, NULL, "http://google.com/",
sett, NULL); // Here it crash