diff src/cmdloop.c @ 48:56c54cf7c5b6 r19-16b90

Import from CVS: tag r19-16b90
author cvs
date Mon, 13 Aug 2007 08:56:04 +0200
parents 859a2309aef8
children 131b0175ea99
line wrap: on
line diff
--- a/src/cmdloop.c	Mon Aug 13 08:55:32 2007 +0200
+++ b/src/cmdloop.c	Mon Aug 13 08:56:04 2007 +0200
@@ -216,6 +216,26 @@
 static DOESNT_RETURN
 command_loop_3 (void)
 {
+#ifdef LWLIB_MENUBARS_LUCID
+  extern int in_menu_callback;  /* defined in menubar-x.c */
+#endif /* LWLIB_MENUBARS_LUCID */
+
+#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,
+   * but waiting to signal an error there is too late in case where
+   * a new command loop has been started.  The error will be caught
+   * and Fnext_event will be called again, looping forever.  So we
+   * signal an error here to avoid the loop.
+   */
+  if (in_menu_callback)
+    error ("Attempt to enter command_loop_3 inside menu callback");
+#endif /* LWLIB_MENUBARS_LUCID */
   /* This function can GC */
   for (;;)
     {