Skip to content

Commit

Permalink
Add XLib error handler
Browse files Browse the repository at this point in the history
  • Loading branch information
gujjwal00 committed Sep 25, 2024
1 parent c23be95 commit 1387a19
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions unix/x0vncserver/XDesktop.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,15 @@ XDesktop::XDesktop(Display* dpy_, Geometry *geometry_)
}
#endif

// Need to set an error handler for XLib because most errors are reported
// asynchronously and default handler terminates the process on any error.
XSetErrorHandler([](Display* d, XErrorEvent* ev) -> int {
char buff[1024];
XGetErrorText(d, ev->error_code, buff, sizeof(buff));
vlog.error("XLib error: %s", buff);
return 0;
});

TXWindow::setGlobalEventHandler(this);
}

Expand Down

0 comments on commit 1387a19

Please sign in to comment.