diff src/event-stream.c @ 138:6608ceec7cf8 r20-2b3

Import from CVS: tag r20-2b3
author cvs
date Mon, 13 Aug 2007 09:31:46 +0200
parents cca96a509cfe
children 1856695b1fa9
line wrap: on
line diff
--- a/src/event-stream.c	Mon Aug 13 09:31:13 2007 +0200
+++ b/src/event-stream.c	Mon Aug 13 09:31:46 2007 +0200
@@ -1989,11 +1989,28 @@
     XCOMMAND_BUILDER (con->command_builder);
   int store_this_key = 0;
   struct gcpro gcpro1;
+#ifdef LWLIB_MENUBARS_LUCID
+  extern int in_menu_callback;  /* defined in menubar-x.c */
+#endif /* LWLIB_MENUBARS_LUCID */
+
   GCPRO1 (event);
-
   /* DO NOT do QUIT anywhere within this function or the functions it calls.
      We want to read the ^G as an event. */
 
+#ifdef LWLIB_MENUBARS_LUCID
+  /*
+   * #### Fix the menu code so this isn't necessary.
+   *
+   * We cannot allow the lwmenu code to be reentered, because the
+   * code is not written to be reentrant and will crash.  Therefore
+   * paths from the menu callbacks back into the menu code have to
+   * be blocked.  Fnext_event is the normal path into the menu code,
+   * so we signal an error here.
+   */
+  if (in_menu_callback)
+    error ("Attempt to call next-event inside menu callback");
+#endif /* LWLIB_MENUBARS_LUCID */
+
   if (NILP (event))
     event = Fmake_event ();
   else