diff -up emacs-23.3/src/xgselect.c.xgselect emacs-23.3/src/xgselect.c
--- emacs-23.3/src/xgselect.c.xgselect 2011-11-25 14:05:03.963372281 +0100
+++ emacs-23.3/src/xgselect.c 2011-11-25 14:06:49.798049160 +0100
@@ -53,12 +53,17 @@ xg_select (max_fds, rfds, wfds, efds, ti
g_main_context_pending (context);
do {
- if (n_gfds > gfds_size)
+ if (n_gfds > gfds_size)
{
- while (n_gfds > gfds_size)
- gfds_size *= 2;
- xfree (gfds);
- gfds = xmalloc (sizeof (*gfds) * gfds_size);
+ if (gfds_size == 0)
+ xgselect_initialize ();
+ else
+ {
+ while (n_gfds > gfds_size)
+ gfds_size *= 2;
+ xfree (gfds);
+ gfds = xmalloc (sizeof (*gfds) * gfds_size);
+ }
}
n_gfds = g_main_context_query (context,