]> granicus.if.org Git - nethack/commitdiff
a late bot() call was observed on GUI Windows so prevent such a crash
authornhmall <nhmall@nethack.org>
Sun, 9 Dec 2018 03:08:55 +0000 (22:08 -0500)
committernhmall <nhmall@nethack.org>
Sun, 9 Dec 2018 03:08:55 +0000 (22:08 -0500)
src/botl.c
win/share/safeproc.c
win/win32/mswproc.c

index 2fa84afe0716b83fee28158596daebdc4ea74a92..db96c160b5f59dd166b73343ba8889d272e097f6 100644 (file)
@@ -234,7 +234,8 @@ do_statusline2()
 void
 bot()
 {
-    if (youmonst.data && iflags.status_updates) {
+    /* dosave() flags completion by setting u.uhp to -1 */
+    if ((u.uhp != -1) && youmonst.data && iflags.status_updates) {
 #ifdef STATUS_HILITES
         bot_via_windowport();
 #else
index b3b991a7c8d9bc7b14ebb90ea8b10b95c6aa1e4c..1f268ee1673407856401ace745ac75cf9888f09f 100644 (file)
@@ -11,7 +11,7 @@
  * assigned to the windowproc function pointers very early
  * in the startup initialization, perhaps immediately even.
  * It requires only the following call:
- *          windowprocs = get_safe_procs(0);
+ *          windowprocs = *get_safe_procs(0);
  *
  * The game startup can trigger functions in other modules
  * that make assumptions on a WindowPort being available
  *
  * The additional platform-independent, but more functional
  * routines provided in here should be assigned after the
- *    windowprocs = get_safe_procs()
- * call. Here's a list of them:
+ *    windowprocs = *get_safe_procs(n)
+ * call.
  *
- *  
+ *  Usage:
+ *   
+ *    windowprocs = *get_safe_procs(0);
+ *   initializes a set of winprocs function pointers that ensure
+ *   none of the function pointers are left null, but that's all
+ *   it does.
+ *   
+ *    windowprocs = *get_safe_procs(1);
+ *   initializes a set of winprocs functions pointers that ensure
+ *   none of the function pointers are left null, but also
+ *   provides some basic output and input functionality using
+ *   nothing other than C stdio routines (no platform-specific
+ *   or OS-specific code).
  *
- * 
  * ***********************************************************
  */
 
index 3cfcc95bf19f5ad4695d4e84222959fb9ac10533..85f4277252f68ce031ed5abb750964df215ed6c3 100644 (file)
@@ -718,6 +718,13 @@ mswin_exit_nhwindows(const char *str)
     /* Write Window settings to the registry */
     mswin_write_reg();
 
+    /* set things back to failsafes */
+    windowprocs = *get_safe_procs(0);
+
+    /* and make sure there is still a way to communicate something */
+    windowprocs.win_raw_print = mswin_raw_print;
+    windowprocs.win_raw_print_bold = mswin_raw_print_bold;
+    windowprocs.win_wait_synch = mswin_wait_synch;
 }
 
 /* Prepare the window to be suspended. */