=== modified file 'src/ChangeLog' *** src/ChangeLog 2013-12-08 08:05:36 +0000 --- src/ChangeLog 2013-12-08 16:00:41 +0000 *************** *** 1,3 **** --- 1,9 ---- + 2013-12-08 Jarek Czekalski + + Fix freezing with scroll bars of GTK3 Toolkit (Bug#15801). + * keyboard.c: A comment to unblock_input. + * xgselect.c: Prevent Glib main loop recursion. + 2013-12-08 Paul Eggert Use libcrypto's checksum implementations if available, for speed. === modified file 'src/keyboard.c' *** src/keyboard.c 2013-12-07 23:04:10 +0000 --- src/keyboard.c 2013-12-08 15:20:00 +0000 *************** unblock_input_to (int level) *** 7118,7124 **** /* End critical section. If doing signal-driven input, and a signal came in when input was ! blocked, reinvoke the signal handler now to deal with it. */ void unblock_input (void) --- 7118,7129 ---- /* End critical section. If doing signal-driven input, and a signal came in when input was ! blocked, reinvoke the signal handler now to deal with it. ! ! It will also process queued input, if it was not read before. ! When a longer code sequence does not use block/unblock input ! at all, the whole input gathered up to the next call to ! unblock_input will be processed inside that call. */ void unblock_input (void) === modified file 'src/xgselect.c' *** src/xgselect.c 2013-08-27 19:36:28 +0000 --- src/xgselect.c 2013-12-08 22:54:04 +0000 *************** along with GNU Emacs. If not, see #include #include "frame.h" + #include "blockinput.h" + + /* xg_select is a pselect replacement. Why do we need a separate function? + 1. Timeouts. Glib and Gtk rely on timer events. If we did pselect + with a greater timeout then the one scheduled by Glib, we would + not allow Glib to process its timer events. We want Glib to + work smoothly, so we need to reduce our timeout to match Glib. + 2. Descriptors. Glib may listen to more file descriptors than we do. + So we add Glib descriptors to our pselect pool, but we don't change + the value returned by the function. The return value matches only + the descriptors passed as arguments, making it compatible with + plain pselect. */ int xg_select (int fds_lim, fd_set *rfds, fd_set *wfds, fd_set *efds, *************** xg_select (int fds_lim, fd_set *rfds, fd *** 45,56 **** int i, nfds, tmo_in_millisec; USE_SAFE_ALLOCA; - /* Do not try to optimize with an initial check with g_main_context_pending - and a call to pselect if it returns false. If Gdk has a timeout for 0.01 - second, and Emacs has a timeout for 1 second, g_main_context_pending will - return false, but the timeout will be 1 second, thus missing the gdk - timeout with a lot. */ - context = g_main_context_default (); if (rfds) all_rfds = *rfds; --- 57,62 ---- *************** xg_select (int fds_lim, fd_set *rfds, fd *** 132,139 **** --- 138,150 ---- #ifdef USE_GTK if (retval == 0) #endif + /* Prevent g_main_dispatch recursion, that would occur without + block_input wrapper, because event handlers call + unblock_input. Event loop recursion was causing Bug#15801. */ + block_input(); while (g_main_context_pending (context)) g_main_context_dispatch (context); + unblock_input(); /* To not have to recalculate timeout, return like this. */ if (retval == 0)