mirror of https://github.com/godotengine/godot
Fix BadWindow error when stopping embedded game on Linux
This commit is contained in:
parent
b15b24b087
commit
725dd4930e
|
|
@ -5853,6 +5853,9 @@ Error DisplayServerX11::remove_embedded_process(OS::ProcessID p_pid) {
|
|||
// Handle bad window errors silently because just in case the embedded window was closed.
|
||||
int (*oldHandler)(Display *, XErrorEvent *) = XSetErrorHandler(&bad_window_error_handler);
|
||||
|
||||
// Check if the window is still valid.
|
||||
XWindowAttributes attr;
|
||||
if (XGetWindowAttributes(x11_display, ep->process_window, &attr)) {
|
||||
// Send the message to gracefully close the window.
|
||||
XEvent ev;
|
||||
memset(&ev, 0, sizeof(ev));
|
||||
|
|
@ -5863,6 +5866,7 @@ Error DisplayServerX11::remove_embedded_process(OS::ProcessID p_pid) {
|
|||
ev.xclient.data.l[0] = XInternAtom(x11_display, "WM_DELETE_WINDOW", False);
|
||||
ev.xclient.data.l[1] = CurrentTime;
|
||||
XSendEvent(x11_display, ep->process_window, False, NoEventMask, &ev);
|
||||
}
|
||||
|
||||
// Restore default error handler.
|
||||
XSetErrorHandler(oldHandler);
|
||||
|
|
|
|||
Loading…
Reference in New Issue