From: Eli Zaretskii Date: Thu, 15 Dec 2016 16:18:59 +0000 (+0200) Subject: Prevent crashes in xg_select due to concurrency X-Git-Tag: emacs-26.0.90~1076 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=4fbda463dca50f630c31a2602bd34849f4b51e51;p=emacs.git Prevent crashes in xg_select due to concurrency * src/xgselect.c (xg_select): Don't call Glib functions that use 'context' if we failed to acquire it. This means some other thread owns the context, in which case both using the context and calling block_input/unblock_input will step on that thread's toes and eventually lead to crashes. (Bug#25172) --- diff --git a/src/xgselect.c b/src/xgselect.c index 2f23764ae41..a9461a5df5a 100644 --- a/src/xgselect.c +++ b/src/xgselect.c @@ -150,7 +150,7 @@ xg_select (int fds_lim, fd_set *rfds, fd_set *wfds, fd_set *efds, #else need_to_dispatch = true; #endif - if (need_to_dispatch) + if (need_to_dispatch && context_acquired) { int pselect_errno = errno; /* Prevent g_main_dispatch recursion, that would occur without