mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Linux: Install xlib error handlers to avoid crash on X11 error (issue #1337).
git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/2062@1845 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@ -46,6 +46,21 @@ class MainBrowserProvider : public OSRBrowserProvider {
|
||||
}
|
||||
} g_main_browser_provider;
|
||||
|
||||
int XErrorHandlerImpl(Display *display, XErrorEvent *event) {
|
||||
LOG(WARNING)
|
||||
<< "X error received: "
|
||||
<< "type " << event->type << ", "
|
||||
<< "serial " << event->serial << ", "
|
||||
<< "error_code " << static_cast<int>(event->error_code) << ", "
|
||||
<< "request_code " << static_cast<int>(event->request_code) << ", "
|
||||
<< "minor_code " << static_cast<int>(event->minor_code);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int XIOErrorHandlerImpl(Display *display) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
void destroy(GtkWidget* widget, gpointer data) {
|
||||
// Quitting CEF is handled in ClientHandler::OnBeforeClose().
|
||||
}
|
||||
@ -403,6 +418,11 @@ int main(int argc, char* argv[]) {
|
||||
// Populate the settings based on command line arguments.
|
||||
AppGetSettings(settings);
|
||||
|
||||
// Install xlib error handlers so that the application won't be terminated
|
||||
// on non-fatal errors.
|
||||
XSetErrorHandler(XErrorHandlerImpl);
|
||||
XSetIOErrorHandler(XIOErrorHandlerImpl);
|
||||
|
||||
// Initialize CEF.
|
||||
CefInitialize(main_args, settings, app.get(), NULL);
|
||||
|
||||
|
Reference in New Issue
Block a user