From d5fed54a0c214967fc618f397b55174af54cc33a Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 26 Dec 2022 19:18:25 +0100 Subject: [PATCH] x11: Fix occasional crash on shutdown --- panda/src/x11display/x11GraphicsWindow.cxx | 6 +++--- panda/src/x11display/x11GraphicsWindow.h | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/panda/src/x11display/x11GraphicsWindow.cxx b/panda/src/x11display/x11GraphicsWindow.cxx index eae17632f0..b96c4c4f82 100644 --- a/panda/src/x11display/x11GraphicsWindow.cxx +++ b/panda/src/x11display/x11GraphicsWindow.cxx @@ -121,6 +121,7 @@ x11GraphicsWindow(GraphicsEngine *engine, GraphicsPipe *pipe, _override_redirect = False; _wm_delete_window = x11_pipe->_wm_delete_window; _net_wm_ping = x11_pipe->_net_wm_ping; + _net_wm_state = x11_pipe->_net_wm_state; PT(GraphicsWindowInputDevice) device = GraphicsWindowInputDevice::pointer_and_keyboard(this, "keyboard_mouse"); add_input_device(device); @@ -368,9 +369,7 @@ process_events() { case PropertyNotify: //std::cout << "PropertyNotify event: atom = " << event.xproperty.atom << std::endl; - x11GraphicsPipe *x11_pipe; - DCAST_INTO_V(x11_pipe, _pipe); - if (event.xproperty.atom == x11_pipe->_net_wm_state) { + if (event.xproperty.atom == _net_wm_state) { // currently we're only interested in the net_wm_state type of // changes and only need to gather property informations once at // the end after the while loop @@ -516,6 +515,7 @@ process_events() { } else if ((Atom)(event.xclient.data.l[0]) == _net_wm_ping && event.xclient.window == _xwindow) { + x11GraphicsPipe *x11_pipe; DCAST_INTO_V(x11_pipe, _pipe); event.xclient.window = x11_pipe->get_root(); XSendEvent(_display, x11_pipe->get_root(), False, SubstructureRedirectMask | SubstructureNotifyMask, &event); diff --git a/panda/src/x11display/x11GraphicsWindow.h b/panda/src/x11display/x11GraphicsWindow.h index 49b878a904..1bb20e181e 100644 --- a/panda/src/x11display/x11GraphicsWindow.h +++ b/panda/src/x11display/x11GraphicsWindow.h @@ -109,6 +109,7 @@ protected: Bool _override_redirect; Atom _wm_delete_window; Atom _net_wm_ping; + Atom _net_wm_state; x11GraphicsPipe::pfn_XRRGetScreenInfo _XRRGetScreenInfo; x11GraphicsPipe::pfn_XRRSetScreenConfig _XRRSetScreenConfig;