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.
This commit is contained in:
@@ -1403,6 +1403,12 @@ weston_wm_handle_client_message(struct weston_wm *wm,
|
|||||||
client_message->data.data32[4],
|
client_message->data.data32[4],
|
||||||
client_message->window);
|
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)
|
if (client_message->type == wm->atom.net_wm_moveresize)
|
||||||
weston_wm_window_handle_moveresize(window, client_message);
|
weston_wm_window_handle_moveresize(window, client_message);
|
||||||
else if (client_message->type == wm->atom.net_wm_state)
|
else if (client_message->type == wm->atom.net_wm_state)
|
||||||
|
|||||||
Reference in New Issue
Block a user