summaryrefslogtreecommitdiff
path: root/xwayland
diff options
context:
space:
mode:
authorJason Ekstrand <jason.ekstrand@intel.com>2014-07-24 13:17:47 -0700
committerJason Ekstrand <jason.ekstrand@intel.com>2014-07-24 13:19:13 -0700
commit0250a740c2320d0eeafabfedcbea20ef95b45f43 (patch)
tree35b15209df52ae29b4a5c1b40c6807cf700930ad /xwayland
parent4ff4d92d7e877aadbeade8d5d9fbd77b44d7540a (diff)
downloadweston-0250a740c2320d0eeafabfedcbea20ef95b45f43.tar.gz
xwayland: Better handle a race with X
If X windows are created and destroyed very fast sometimes the WM window object gets created and destroyed before we get around to handling client messages. Failing to check that the window is still valid can result in a segfault.
Diffstat (limited to 'xwayland')
-rw-r--r--xwayland/window-manager.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c
index 5d3a2e5d..6cac2782 100644
--- a/xwayland/window-manager.c
+++ b/xwayland/window-manager.c
@@ -1403,6 +1403,12 @@ weston_wm_handle_client_message(struct weston_wm *wm,
client_message->data.data32[4],
client_message->window);
+ /* The window may get created and destroyed before we actually
+ * handle the message. If it doesn't exist, bail.
+ */
+ if (!window)
+ return;
+
if (client_message->type == wm->atom.net_wm_moveresize)
weston_wm_window_handle_moveresize(window, client_message);
else if (client_message->type == wm->atom.net_wm_state)