]> git.eshelyaron.com Git - emacs.git/commitdiff
Prevent crashes in xg_select due to concurrency
authorEli Zaretskii <eliz@gnu.org>
Thu, 15 Dec 2016 16:18:59 +0000 (18:18 +0200)
committerEli Zaretskii <eliz@gnu.org>
Thu, 15 Dec 2016 16:18:59 +0000 (18:18 +0200)
* 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)

src/xgselect.c

index 2f23764ae418d29a61c39645ac14b58f38d15fad..a9461a5df5a408781c323b93161d19eb91eaf87e 100644 (file)
@@ -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