Subject: bug#15801: 24.3.50; bar scrolling freezes gtk emacs

From: Jarek Czekalski <[email-masked]>
Date: Mon, 02 Dec 2013 09:04:59 +0100

Jan, you got lost with the commit 112892 of yours. You say it has 
nothing to do with -nw, but in the message log you mention -nw. Please 
have one more look at it (at the whole commit), to see that I'm right. 
That's important, because I see a real problem with this commit.

When you created xgselect.c file in r98730 you placed the following 
lines there:

               |   /* Update event sources in GLib. */
               |   g_main_context_pending (context);

As I understand it is that this call is important to update glib sources 
(possibly glib file descriptors too - my guess).

In r109774 Paul removes this comment, while keeping the call to 
g_main_context_pending, but conditionally:

+  if (! (x_in_use
+     && g_main_context_pending (context = g_main_context_default ())))

In r112892 you say that call to g_main_context_pending is not needed at 
all, because it was a bad optimization, which you corrected.

This is a mistake, isn't it?

As a side note: I'm still trying to investigate my freeze. So far I know 
that in the "freezed" state xgselect returns non-zero, while 
XTread_socket returns 0. And this happens repeatedly and very quickly.

Side note 2: detailed description of the bug being fixed in a commit is 
very important. Otherwise after just a few months we don't know what we 
really fixed. A link to a bug report or to a discussion on a mailing 
list would be very valueable. We don't have this information in commit 
r112892.

Another concern when I analyze xgselect is why we increase the number of 
tested selectors over the number requested by the caller? If a caller 
receives a positive number, it thinks that there is something to read. 
But it will check only the descriptors up to the number it specified in 
the call. This doesn't make sense to me. Shouldn't it be specified in 
the documentation of xgselect, that it may surprise caller with false 
positives? This is not the usual behaviour of select-like calls, is it? 
And this is something that was changed by your commit. Previously a 
standard pselect was returned (under some circumstances). After that, 
the extended version, with false positives.

Jarek