fix early crash during config file error processing
authornhmall <nhmall@nethack.org>
Mon, 21 May 2018 20:39:16 +0000 (16:39 -0400)
committernhmall <nhmall@nethack.org>
Mon, 21 May 2018 20:39:16 +0000 (16:39 -0400)
doc/fixes36.2
src/windows.c

index 3c15cf87389f45e02955aabad857df187f95c33f..2cdd77fdc95c5759abbcbbd86678bc796d06e93b 100644 (file)
@@ -19,6 +19,8 @@ permanent inventory window was updated too soon when a scroll of charging
 for starting inventory, don't give an orc hero lembas wafers or cram rations
 targetting with a polearm could give away location of hidden monster
 static prototype could be left orphaned depending on #defines in rip.c
+config file error handling routines were calling xx_wait_synch early
+       even before the window system was initialized; add a default routine
 
 
 Fixes to Post-3.6.1 Problems that Were Exposed Via git Repository
index 9a82325d965808325e76b7ff16d9e24e1427f2c8..96d9a218d06db641baeb7f91a78deadcd24468d8 100644 (file)
@@ -1,4 +1,4 @@
-/* NetHack 3.6 windows.c       $NHDT-Date: 1495232365 2017/05/19 22:19:25 $  $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.41 $ */
+/* NetHack 3.6 windows.c       $NHDT-Date: 1526933747 2018/05/21 20:15:47 $  $NHDT-Branch: NetHack-3.6.2 $:$NHDT-Revision: 1.48 $ */
 /* Copyright (c) D. Cohrs, 1993. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -56,6 +56,7 @@ extern void *FDECL(trace_procs_chain, (int, int, void *, void *, void *));
 #endif
 
 STATIC_DCL void FDECL(def_raw_print, (const char *s));
+STATIC_DCL void NDECL(def_wait_synch);
 
 #ifdef DUMPLOG
 STATIC_DCL winid FDECL(dump_create_nhwindow, (int));
@@ -191,6 +192,22 @@ const char *s;
     puts(s);
 }
 
+STATIC_OVL
+void
+def_wait_synch(VOID_ARGS)
+{
+    /* Config file error handling routines
+     * call wait_sync() without checking to
+     * see if it actually has a value,
+     * leading to spectacular violations
+     * when you try to execute address zero.
+     * The existence of this allows early
+     * processing to have something to execute
+     * even though it essentially does nothing
+     */
+     return;
+}
+
 #ifdef WINCHAIN
 static struct win_choices *
 win_choices_find(s)
@@ -232,6 +249,9 @@ const char *s;
 
     if (!windowprocs.win_raw_print)
         windowprocs.win_raw_print = def_raw_print;
+    if (!windowprocs.win_wait_synch)
+        /* early config file error processing routines call this */
+        windowprocs.win_wait_synch = def_wait_synch;
 
     if (!winchoices[0].procs) {
         raw_printf("No window types?");