summaryrefslogtreecommitdiff
path: root/xwayland
diff options
context:
space:
mode:
authorDerek Foreman <derekf@osg.samsung.com>2015-04-09 14:48:22 -0500
committerPekka Paalanen <pekka.paalanen@collabora.co.uk>2015-04-10 10:00:59 +0300
commit9a0b2b54e2242af0371c98e00e1d3ea0a70064a1 (patch)
tree39b3517ac004169511c83467abd9bddf66d029cc /xwayland
parent90f23ca3f46f8721496ee5d7b73c24a2f17dd4f5 (diff)
downloadweston-9a0b2b54e2242af0371c98e00e1d3ea0a70064a1.tar.gz
xwm: Fix a weston crash when a window surface is created after unmap
If windows are created and quickly destroyed it's possible that they'll be on the unpaired window list at the time of surface creation. The surface destroy listener for that surface isn't properly freed and a crash happens some time later. This patch removes the window from the unpaired list during unmap, so we should never get to the destroy handler with a surface destroy listener set. Just in case there's another path to that failure, I've also removed the surface destroy listener in the destory handler. Signed-off-by: Derek Foreman <derekf@osg.samsung.com> Acked-by: Jasper St. Pierre <jstpierre@mecheye.net> Reviewed-by: Pekka Paalanen <pekka.paalanen@collabora.co.uk>
Diffstat (limited to 'xwayland')
-rw-r--r--xwayland/window-manager.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/xwayland/window-manager.c b/xwayland/window-manager.c
index 5d22ded0..cab7e20e 100644
--- a/xwayland/window-manager.c
+++ b/xwayland/window-manager.c
@@ -1001,6 +1001,14 @@ weston_wm_handle_unmap_notify(struct weston_wm *wm, xcb_generic_event_t *event)
if (!wm_lookup_window(wm, unmap_notify->window, &window))
return;
+ if (window->surface_id) {
+ /* Make sure we're not on the unpaired surface list or we
+ * could be assigned a surface during surface creation that
+ * was mapped before this unmap request.
+ */
+ wl_list_remove(&window->link);
+ window->surface_id = 0;
+ }
if (wm->focus_window == window)
wm->focus_window = NULL;
if (window->surface)
@@ -1207,6 +1215,9 @@ weston_wm_window_destroy(struct weston_wm_window *window)
if (window->surface_id)
wl_list_remove(&window->link);
+ if (window->surface)
+ wl_list_remove(&window->surface_destroy_listener.link);
+
hash_table_remove(window->wm->window_hash, window->id);
free(window);
}