Avoid using window id as identifier in finish_destroy_win

Under extreme race conditions (window A close at the same time as window
B create), there can be multiple windows with same id in compton's window
list. If at this point window B closes itself as well, finish_destroy_win
might destroy a different window as what's passed to destroy_callback.

This can be a problem because someone can still hold a reference to that
window (e.g. 't' in paint_preprocess), and there's no way to clear that
reference. If finish_destroy_win always destroy the same window passed
to destroy_callback, this will not be a problem.
This commit is contained in:
Yuxuan Shui
2016-07-14 16:43:20 -04:00
parent f4f39d1989
commit cfdb946992
2 changed files with 9 additions and 8 deletions

View File

@ -919,7 +919,7 @@ static void
circulate_win(session_t *ps, XCirculateEvent *ce);
static void
finish_destroy_win(session_t *ps, Window id);
finish_destroy_win(session_t *ps, win *w);
static void
destroy_callback(session_t *ps, win *w);