Browse Source

x11: Fix occasional crash on shutdown

rdb 3 years ago
parent
commit
d5fed54a0c

+ 3 - 3
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);

+ 1 - 0
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;